forked from DevExpress/DevExtreme
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathApp.js
More file actions
60 lines (59 loc) · 1.49 KB
/
App.js
File metadata and controls
60 lines (59 loc) · 1.49 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
import React from 'react';
import VectorMap, {
Label, Layer, Legend, Source, Tooltip,
} from 'devextreme-react/vector-map';
import * as mapsData from 'devextreme-dist/js/vectormap-data/world.js';
import { markers } from './data.js';
const sizeGroups = [0, 8000, 10000, 50000];
const bounds = [-180, 85, 180, -60];
const customizeTooltip = (arg) => {
if (arg.layer.type === 'marker') {
return { text: arg.attribute('tooltip') };
}
return {};
};
const customizeText = (arg) => ['< 8000K', '8000K to 10000K', '> 10000K'][Number(arg.index)];
const customizeItems = (items) => items.reverse();
export default function App() {
return (
<VectorMap
id="vector-map"
bounds={bounds}
>
<Layer
dataSource={mapsData.world}
hoverEnabled={false}
></Layer>
<Layer
dataSource={markers}
name="bubbles"
elementType="bubble"
dataField="value"
minSize={20}
maxSize={40}
sizeGroups={sizeGroups}
opacity={0.8}
>
<Label enabled={false}></Label>
</Layer>
<Tooltip
enabled={true}
customizeTooltip={customizeTooltip}
></Tooltip>
<Legend
markerShape="circle"
customizeItems={customizeItems}
customizeText={customizeText}
>
<Source
layer="bubbles"
grouping="size"
></Source>
</Legend>
<Tooltip
enabled={true}
customizeTooltip={customizeTooltip}
/>
</VectorMap>
);
}