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
var dataSet = anychart.data.set([
3
{'id': 'AU.WA', 'value': 300}, // Western Australia
4
{'id': 'AU.JB', 'value': 270}, // Jervis Bay Territory
5
{'id': 'AU.NS', 'value': 240}, // New South Wales
6
{'id': 'AU.VI', 'value': 75}, // Victoria
7
{'id': 'AU.NT', 'value': 130}, // Northern Territory
8
{'id': 'AU.TS', 'value': 190}, // Tasmania
9
{'id': 'AU.CT', 'value': 100}, // Australian Capital Territory
10
{'id': 'AU.SA', 'value': 280}, // South Australia
11
{'id': 'AU.QL', 'value': 220} // Queensland
12
]);
13
14
// create map
15
var map = anychart.map();
16
map.geoData(anychart.maps.australia);
17
18
// set the title and its preferences
19
map.title('Linear Color Scale');
20
21
// set the series
22
var series = map.choropleth(dataSet);
23
series.stroke("2 white 0");
24
series.colorScale(anychart.scales.linearColor('#EC6E07', '#64B5F6'));
25
26
// disable the labels
27
series.labels(false);
28
29
// set the container
30
map.container('container');
31
map.draw();
32
});