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/Maps/Map_Projections
8
9
// create map
10
var map = anychart.map();
11
12
// create bubble series
13
series_1 = map.bubble(getData1());
14
series_2 = map.bubble(getData2());
15
16
//disable the labels
17
series_1.labels(false);
18
series_2.labels(false);
19
20
//set bubble min/max size settings
21
map.maxBubbleSize(9);
22
map.minBubbleSize(2);
23
24
// change the fill and hoverFill colors of series_1
25
series_1.fill("#7D00AD", 0.35);
26
series_1.hovered().fill("#7D00AD", 0.7);
27
28
// change the stroke and hoverStroke colors of series_1
29
series_1.stroke("#BA005C");
30
series_1.hovered().stroke("#BA005C");
31
32
// set the select colors of series_1
33
series_1.selected().stroke("#BA005C");
34
series_1.selected().fill("#D1003D");
35
36
// change the fill and hoverFill colors of series_2
37
series_2.fill("#178AA8", 0.35);
38
series_2.hovered().fill("#3675BD", 0.7);
39
40
// change the stroke and hoverStroke colors of series_2
41
series_2.stroke("#3675BD");
42
series_2.hovered().stroke("#178AA8");
43
44
// set the select colors of series_2
45
series_2.selected().stroke("#3675BD");
46
series_2.selected().fill("#734CE6");
47
48
// tooltip formatting
49
map.tooltip().format("{%seriesName} {%size}%");
50
51
// set geo data, you can find this map in our geo maps collection
52
// https://cdn.anychart.com/#maps-collection
53
map.geoData(anychart.maps['united_kingdom']);
54
55
//set map container id (div)
56
map.container('container');
57
58
//initiate map drawing
59
map.draw();
60
});
61
62
function getData1(){
63
return [
64
['GB.WI', 2],
65
['GB.AB', 1.5],
66
['GB.AG', 1.8],
67
['GB.AS', 0.8],
68
['GB.MO', 1.3],
69
['GB.BO', 1.4],
70
['GB.NN', 2.7],
71
['GB.WH', 1.8],
72
['GB.FI', 2.5],
73
['GB.CU', 2],
74
['GB.ST', 1.5],
75
['GB.PO', 1.8],
76
['GB.SF', 0.8],
77
['GB.KE', 1.3],
78
['GB.WS', 1.4],
79
['GB.DS', 2.7],
80
['GB.CO', 1.8],
81
['GB.DN', 2.5],
82
['GB.NY', 1.8],
83
['GB.EY', 0.8],
84
['GB.CI', 1.3],
85
['GB.PE', 1.4],
86
['GB.RL', 2.7],
87
['GB.LC', 1.8]
88
];
89
}
90
91
function getData2(){
92
return [
93
['GB.AR', 1.4],
94
['GB.WD', 1.4],
95
['GB.SL', 2.5],
96
['GB.EL', 1.5],
97
['GB.DG', 1.7],
98
['GB.EA', 3.3],
99
['GB.IC', 3.1],
100
['GB.HI', 1.4],
101
['GB.CR', 1.4],
102
['GB.BU', 2.5],
103
['GB.MK', 1.5],
104
['GB.NA', 1.7],
105
['GB.BW', 3.3],
106
['GB.DA', 3.1],
107
['GB.TF', 2.1],
108
['GB.RT', 3.5],
109
['GB.CH', 1.5],
110
['GB.DW', 1.7],
111
['GB.LM', 3.3],
112
['GB.CM', 3.1],
113
['GB.DO', 2.1],
114
['GB.IW', 3.5]
115
];
116
}