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
worldDataSet = [
10
{id: "US", name: "USA", value: "A1"}
11
];
12
13
usaDataSet = [
14
{"id": "US.TX", "value": 23}
15
];
16
17
txMap = anychart.map();
18
txMap.geoData(anychart.maps["texas"]);
19
20
map = anychart.map();
21
map.geoData(anychart.maps.united_states_of_america);
22
usaSeries = map.choropleth(usaDataSet);
23
24
var chart = anychart.map();
25
chart.geoData(anychart.maps.world);
26
worldSeries = chart.choropleth(worldDataSet);
27
chart.title("Click at the title to get one level up");
28
29
// title setting
30
txTitle = txMap.title("Click at the title to get one level up");
31
usaTitle = map.title("Click at the title to get one level up");
32
33
chart.container("container");
34
chart.draw();
35
36
// set drill down
37
worldSeries.listen("pointClick", function(e) {
38
// Drill down to specified map.
39
chart.drillTo(e.point.get("id"), map);
40
});
41
42
usaSeries.listen("pointClick", function(e) {
43
// Drill down to specified map.
44
chart.drillTo(e.point.get("id"), txMap);
45
});
46
47
// set drill up
48
txTitle.listen("click", function(e){
49
txMap.drillUp();
50
});
51
52
usaTitle.listen("click", function(e){
53
map.drillUp();
54
});
55
});