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
var dataSet = anychart.data.set([
10
{'id': 'AU.WA', 'value': 300}, // Western Australia
11
{'id': 'AU.JB'}, // Jervis Bay Territory
12
{'id': 'AU.NS', 'value': 240}, // New South Wales
13
{'id': 'AU.VI', 'value': 75}, // Victoria
14
{'id': 'AU.NT', 'value': 130}, // Northern Territory
15
{'id': 'AU.TS', 'value': 190}, // Tasmania
16
{'id': 'AU.CT', labels: false}, // Australian Capital Territory
17
{'id': 'AU.SA'}, // South Australia
18
{'id': 'AU.QL'} // Queensland
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(dataSet);
33
series.geoIdField('code_hasc');
34
series.labels().fontColor('black');;
35
36
// set the container
37
map.container('container');
38
map.draw();
39
});