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
// All maps created with geoData() method work only if you referenced a proper map
3
// source file as described at https://docs.anychart.com/Maps/Quick_Start
4
5
// This sample uses 3rd party Proj4js JavaScript library to transform coordinates
6
// See https://docs.anychart.com/Maps/Map_Projections to learn more.
7
8
var worldDataSet = anychart.data.set([
9
{id: "CA", name: "Canada", value: "A1"},
10
{id: "MN", name: "Mongolia", value: "A1"}
11
]);
12
13
var canadaMap = anychart.map();
14
canadaMap.geoData(anychart.maps.canada);
15
16
var chart = anychart.map();
17
chart.geoData(anychart.maps.world);
18
chart.choropleth(worldDataSet);
19
20
chart.listen("drillChange", function () {
21
var path = chart.getDrilldownPath();
22
23
// Get properties.
24
var properties = path[1].getProperties();
25
26
canadaMap.title("Get properties. The continent is " + properties["continent"] + ".");
27
});
28
29
chart.container("container");
30
chart.draw();
31
chart.drillTo("CA", canadaMap);
32
});