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
// This sample uses 3rd party Proj4js JavaScript library to transform coordinates
3
// See https://docs.anychart.com/Maps/Map_Projections to learn more.
4
5
var dataSet = anychart.data.set([
6
{id: "FR.A", title: "Strasbourg", value: 928},
7
{id: "FR.B", title: "Bordeaux", value: 192},
8
{id: "FR.C", title: "Clermont-Ferrand", value: 963},
9
{id: "FR.P", title: "Caen", value: 266},
10
{id: "FR.D", title: "Dijon", value: 518},
11
{id: "FR.E", title: "Rennes", value: 324}
12
]);
13
dataSet.mapAs({id: "id"});
14
15
var franceMap = anychart.map();
16
franceMap.geoData(anychart.maps.france);
17
18
var series = franceMap.choropleth(dataSet);
19
20
franceMap.container("container");
21
franceMap.draw();
22
23
franceMap.listen("pointClick", function (e) {
24
// Gets point properties.
25
var properties = e.point.getFeatureProp();
26
27
franceMap.title("Point name (capital): " + properties.nom_cl);
28
// Click on point.
29
});
30
});