HTMLcopy
1
<div id="container"></div>
CSScopy
6
1
html, body, #container {
2
width: 100%;
3
height: 100%;
4
margin: 0;
5
padding: 0;
6
}
JavaScriptcopy
x
1
anychart.onDocumentReady(function() {
2
3
// This sample uses 3rd party proj4 component
4
// that makes it possible to set coordinates
5
// for the points and labels on the map and
6
// required for custom projections and grid labels formatting.
7
// See https://docs.anychart.com/7.14.3/Maps/Map_Projections
8
9
// create map
10
var map = anychart.map();
11
12
// create data sets
13
var dataSet_1 = anychart.data.set([
14
['GB.WI', 2],
15
['GB.AB', 1.5],
16
['GB.AG', 1.8],
17
['GB.AS', 0.8],
18
['GB.MO', 1.3],
19
['GB.BO', 1.4],
20
['GB.NN', 2.7],
21
['GB.WH', 1.8],
22
['GB.FI', 2.5],
23
['GB.CU', 2],
24
['GB.ST', 1.5],
25
['GB.PO', 1.8],
26
['GB.SF', 0.8],
27
['GB.KE', 1.3],
28
['GB.WS', 1.4],
29
['GB.DS', 2.7],
30
['GB.CO', 1.8],
31
['GB.DN', 2.5],
32
['GB.NY', 1.8],
33
['GB.EY', 0.8],
34
['GB.CI', 1.3],
35
['GB.PE', 1.4],
36
['GB.RL', 2.7],
37
['GB.LC', 1.8]
38
]);
39
40
var dataSet_2 = anychart.data.set([
41
['GB.AR', 1.4],
42
['GB.WD', 1.4],
43
['GB.SL', 2.5],
44
['GB.EL', 1.5],
45
['GB.DG', 1.7],
46
['GB.EA', 3.3],
47
['GB.IC', 3.1],
48
['GB.HI', 1.4],
49
['GB.CR', 1.4],
50
['GB.BU', 2.5],
51
['GB.MK', 1.5],
52
['GB.NA', 1.7],
53
['GB.BW', 3.3],
54
['GB.DA', 3.1],
55
['GB.TF', 2.1],
56
['GB.RT', 3.5],
57
['GB.CH', 1.5],
58
['GB.DW', 1.7],
59
['GB.LM', 3.3],
60
['GB.CM', 3.1],
61
['GB.DO', 2.1],
62
['GB.IW', 3.5]
63
]);
64
// create bubble series
65
series_1 = map.bubble(dataSet_1);
66
series_2 = map.bubble(dataSet_2);
67
68
// set geoIdField to 'id', this field contains in geo data meta properties
69
series_1.geoIdField('id');
70
series_2.geoIdField('id');
71
72
//disable the labels
73
series_1.labels(false);
74
series_2.labels(false);
75
76
//set bubble min/max size settings
77
map.maxBubbleSize(9);
78
map.minBubbleSize(2);
79
80
// change the fill and hoverFill colors of series_1
81
series_1.fill("#7D00AD", 0.35);
82
series_1.hoverFill("#7D00AD", 0.7);
83
84
// change the stroke and hoverStroke colors of series_1
85
series_1.stroke("#BA005C");
86
series_1.hoverStroke("#BA005C");
87
88
// set the select colors of series_1
89
series_1.selectStroke("#BA005C");
90
series_1.selectFill("#D1003D");
91
92
// change the fill and hoverFill colors of series_2
93
series_2.fill("#178AA8", 0.35);
94
series_2.hoverFill("#3675BD", 0.7);
95
96
// change the stroke and hoverStroke colors of series_2
97
series_2.stroke("#3675BD");
98
series_2.hoverStroke("#178AA8");
99
100
// set the select colors of series_2
101
series_2.selectStroke("#3675BD");
102
series_2.selectFill("#734CE6");
103
104
// tooltip formatting
105
series_1.tooltip().format(function(){
106
return ("Employed international workers: "+this.size+ "%");
107
});
108
109
series_2.tooltip().format(function(){
110
return ("Unemployed local workers: "+this.size+ "%");
111
});
112
113
// set geo data, you can find this map in our geo maps collection
114
// https://cdn.anychart.com/#maps-collection
115
map.geoData(anychart.maps['united_kingdom']);
116
117
//set map container id (div)
118
map.container('container');
119
120
//initiate map drawing
121
map.draw();
122
});