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"},
11
{id: "AU.VI", value: 23, title: "Victoria"},
12
{id: "AU.NT", value: 64, title: "Northern Territory"},
13
{id: "AU.TS", value: 28, title: "Tasmania"},
14
{id: "AU.SA", value: 45, title: "South Australian"}
15
]);
16
17
var secondDataSet = anychart.data.set([
18
{id: "AU.WA", value: 86, title: "Western Australia"},
19
{id: "AU.QL", value: 16, title: "Queensland"},
20
{id: "AU.NS", value: 32, title: "New South Wales"}
21
]);
22
23
var firstDataSetForSeries = firstDataSet.mapAs({id: "id"});
24
var secondDataSetForSeries = secondDataSet.mapAs({id: "id"});
25
26
var australiaMap = anychart.map();
27
australiaMap.geoData(anychart.maps.australia);
28
29
var firstSeries = australiaMap.choropleth(firstDataSetForSeries);
30
31
// set the color for the regions of the first series
32
firstSeries.fill('#FFCC99');
33
34
// set the color for the hovered regions of the first series
35
firstSeries.hoverFill('#FFFF66');
36
37
var secondSeries = australiaMap.choropleth(secondDataSetForSeries);
38
39
// set the color for the regions of the second series
40
secondSeries.fill('#8CE3B0');
41
42
// set the image for the hovered regions of the second series
43
secondSeries.hoverFill({
44
src: "https://static.anychart.com/images/oceanic-airlines.png",
45
mode: "stretch",
46
opacity: 0.3
47
});
48
49
australiaMap.container("container");
50
australiaMap.draw();
51
});