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
var data = [
10
{'id': 'AU.WA', 'value': 300},
11
{'id': 'AU.JB'},
12
{'id': 'AU.NS', 'value': 240},
13
{'id': 'AU.VI', 'value': 75},
14
{'id': 'AU.NT', 'value': 130},
15
{'id': 'AU.TS', 'value': 190},
16
{'id': 'AU.CT'},
17
{'id': 'AU.SA'},
18
{'id': 'AU.QL'}
19
];
20
21
//
22
var map = anychart.map();
23
map.geoData(anychart.maps.australia);
24
25
// set the background color
26
// map.background('Gainsboro');
27
// set the title and its preferences
28
map.title().useHtml(true).hAlign('center');
29
map.title('<span style="font-size: 18px;">Data Setting</span><br><span style="font-size:12px;">Move the mouse over the districts to see which have values</span>');
30
31
// set the series
32
var series = map.choropleth(data);
33
series.labels().fontColor('black');;
34
35
// set the container
36
map.container('container');
37
map.draw();
38
});