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
//create data set
4
var dataSet = anychart.data.set([
5
{'id': 'AU.NS', 'size': 3565500},
6
{'id': 'AU.NT', 'size': 6243700},
7
{'id': 'AU.WA', 'size': 18565600},
8
{'id': 'AU.SA', 'size': 8282600},
9
{'id': 'AU.VI', 'size': 1866300},
10
{'id': 'AU.QL', 'size': 9750500},
11
{'id': 'AU.TS', 'size': 514700}
12
]);
13
14
//create map chart
15
var chart = anychart.map();
16
17
//set geodata using https://cdn.anychart.com/geodata/1.0.0/countries/australia/australia.js
18
chart.geoData(anychart.maps.australia);
19
20
//set bubble min/max size settings
21
chart.maxBubbleSize('18%');
22
23
//create bubble series
24
var series = chart.bubble(dataSet);
25
series.labels(true);
26
series.labels().format(function () {
27
return (this.size / this.getStat('seriesSum') * 100).toFixed(2) + '%';
28
});
29
30
//set series geo id field settings
31
series.geoIdField("code_hasc");
32
33
//set container id for the chart
34
chart.container('container');
35
//initiate chart drawing
36
chart.draw();
37
});