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
// This sample uses 3rd party Proj4js JavaScript library to transform coordinates
3
// See https://docs.anychart.com/Maps/Map_Projections to learn more.
4
5
var dataSet = anychart.data.set([
6
{id: "AU.CT", value: 15, title: "Australian Capital Territory"},
7
{id: "AU.VI", value: 23, title: "Victoria"},
8
{id: "AU.WA", value: 86, title: "Western Australia"},
9
{id: "AU.QL", value: 16, title: "Queensland"},
10
{id: "AU.NS", value: 32, title: "New South Wales"},
11
{id: "AU.NT", value: 64, title: "Northern Territory"},
12
{id: "AU.TS", value: 28, title: "Tasmania"},
13
{id: "AU.SA", value: 45, title: "South Australian"}
14
]);
15
16
var dataSetForSeries = dataSet.mapAs({id: "id"});
17
18
var australiaMap = anychart.map();
19
australiaMap.geoData(anychart.maps.australia);
20
21
var colorScale = anychart.scales.ordinalColor();
22
23
// Gets inversion scale state.
24
var flagOfInversion = colorScale.inverted();
25
26
colorScale.ranges([
27
{from: 10, to: 30},
28
{from: 30, to: 50},
29
{from: 50, to: 90}
30
]);
31
32
var series = australiaMap.choropleth(dataSetForSeries);
33
series.geoIdField("code_hasc");
34
series.colorScale(colorScale);
35
36
australiaMap.title("The current inverse scale state is " + flagOfInversion);
37
australiaMap.colorRange(true);
38
australiaMap.container("container");
39
australiaMap.draw();
40
});