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 firstDataSet = anychart.data.set([
10
{id: "AU.CT", value: 15, title: "Australian Capital Territory", fill:'#33CC33'},
11
{id: "AU.VI", value: 23, title: "Victoria", fill:'#33CC33'},
12
{id: "AU.NT", value: 64, title: "Northern Territory", fill:'#99FF66'},
13
{id: "AU.TS", value: 28, title: "Tasmania", fill:'#99FF33'},
14
{id: "AU.SA", value: 45, title: "South Australian", fill:'#FFFF66'}
15
]);
16
17
var secondDataSet = anychart.data.set([
18
{id: "AU.WA", value: 86, title: "Western Australia", fill:'#99CC00'},
19
{id: "AU.QL", value: 16, title: "Queensland", fill:'#CCCC00'},
20
{id: "AU.NS", value: 32, title: "New South Wales", fill:'#FFCC66'}
21
]);
22
23
var firstDataSetForSeries = firstDataSet.mapAs({id: "id", value:"value", title:"title", fill:"fill"});
24
var secondDataSetForSeries = secondDataSet.mapAs({id: "id", value:"value", title:"title", fill:"fill"});
25
26
var australiaMap = anychart.map();
27
australiaMap.geoData(anychart.maps.australia);
28
29
var firstSeries = australiaMap.choropleth(firstDataSetForSeries);
30
firstSeries.fill('#FFCC99');
31
32
var secondSeries = australiaMap.choropleth(secondDataSetForSeries);
33
secondSeries.fill('#8CE3B0');
34
35
australiaMap.container("container");
36
australiaMap.draw();
37
});