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
]);
11
12
var canadaMap = anychart.map();
13
canadaMap.geoData(anychart.maps.canada);
14
15
var chart = anychart.map();
16
chart.title('The world map');
17
18
chart.listen('drillChange', function () {
19
var path = chart.getDrilldownPath();
20
21
// Get parent chart.
22
var parentChart = path[1].getParentChart();
23
24
var title = parentChart.title();
25
26
canadaMap.title(title.text() + ' is a parent chart for the Canada map');
27
});
28
29
chart.geoData(anychart.maps.world);
30
chart.choropleth(worldDataSet);
31
chart.container('container');
32
chart.draw();
33
chart.drillTo('CA', canadaMap);
34
});