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
worldDataSet = anychart.data.set([
10
{id: "US", name: "USA", value: "A1"}
11
]);
12
13
usaDataSet = anychart.data.set([
14
{"id": "US.TX", "value": 23}
15
]);
16
17
txMap = anychart.map();
18
txMap.geoData(anychart.maps["texas"]);
19
20
usaMap = anychart.map();
21
usaMap.geoData(anychart.maps.united_states_of_america);
22
usaSeries = usaMap.choropleth(usaDataSet);
23
24
var chart = anychart.map();
25
chart.geoData(anychart.maps.world);
26
worldSeries = chart.choropleth(worldDataSet);
27
chart.container("container");
28
chart.draw();
29
30
worldSeries.listen("pointClick", function(e) {
31
// Drill down to specified map
32
chart.drillTo(e.point.get("id"), usaMap);
33
34
});
35
36
usaSeries.listen("pointClick", function(e) {
37
// Drill down to specified map
38
chart.drillTo(e.point.get("id"), txMap);
39
40
});
41
});