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 data set
10
var dataSet = anychart.data.set([
11
['AU.NS', 3.5, 8.5],
12
['AU.NT', 7.1, 12],
13
['AU.WA', 10.4, 2.9],
14
['AU.SA', 4.7, 28.2],
15
['AU.VI', 7.9, 19.4],
16
['AU.QL', 8, 3.7],
17
['AU.TS', 3.2, 7.3]
18
]);
19
20
// create map chart
21
var map = anychart.map();
22
23
map.title("Employed international workers and \nUnemployed local workers");
24
25
// set geoData using https://cdn.anychart.com/geodata/2.2.0/countries/australia/australia.js
26
map.geoData(anychart.maps.australia);
27
28
//set bubble min/max size settings
29
map.maxBubbleSize(70);
30
map.minBubbleSize(20);
31
32
//create bubble series
33
var series_1 = map.bubble(dataSet.mapAs({id: 0, size: 1}));
34
series_1.name("Employed international workers");
35
var series_2 = map.choropleth(dataSet.mapAs({id: 0, value: 2}));
36
series_2.name("Unemployed local workers");
37
38
// change the fill and hoverFill colors of series_1
39
series_1.fill("#EBD670", 0.35);
40
series_1.hovered().fill("#C7FF99", 0.7);
41
42
// change the stroke and hoverStroke colors of series_1
43
series_1.stroke("#C7FF99");
44
series_1.hovered().stroke("#EBD670");
45
46
// set the select colors of series_1
47
series_1.selected().stroke("#66FFCC");
48
series_1.selected().fill("#879CED");
49
50
// set the select colors of series_2
51
series_2.selected().stroke("#3675BD");
52
series_2.selected().fill("#734CE6");
53
54
// set the labels
55
series_1.labels().fontColor('black');
56
series_1.labels().fontSize(10);
57
series_2.labels(false);
58
59
// tooltip formatting
60
series_1.tooltip().format("{%seriesName} {%size}%");
61
62
series_2.tooltip().format("{%seriesName} {%value}%");
63
64
// set the colors and ranges for the scale
65
series_2.colorScale(anychart.scales.linearColor());
66
67
//set the single hue progression
68
var colors = anychart.color.singleHueProgression('#0068BC');
69
70
// define the colors
71
series_2.colorScale().colors(colors);
72
73
// set container id for the chart
74
map.container('container');
75
76
// initiate chart drawing
77
map.draw();
78
});