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/Maps/Map_Projections
8
9
// set the data
10
var data = [
11
{"id": "AU.CT", value: 15},
12
{"id": "AU.VI", value: 23},
13
{"id": "AU.WA", value: 86},
14
{"id": "AU.QL", value: 16},
15
{"id": "AU.NS", value: 32},
16
{"id": "AU.NT", value: 64},
17
{"id": "AU.TS", value: 28},
18
{"id": "AU.SA", value: 45}
19
];
20
21
// create the map
22
var map = anychart.map();
23
map.geoData(anychart.maps.australia);
24
25
// set the map title
26
map.title("Zoom map \n Click here to zoom map two times");
27
28
// listen to the click
29
map.title().listen("click", function () {
30
// Zoom map in 2 times.
31
map.zoom(2);
32
});
33
34
// create choropleth series
35
map.choropleth(data);
36
37
// activate zoomOnMouseWheel
38
map.interactivity().zoomOnMouseWheel(true);
39
40
// set the container for the map
41
map.container("container");
42
43
// draw
44
map.draw();
45
});