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
// create the dataset of points that are defined by the region id
10
var data = [
11
{"id": "AU.NS", "farms": 240},
12
{"id": "AU.NT", "farms": 202},
13
{"id": "AU.WA", "farms": 193},
14
{"id": "AU.SA", "farms": 196},
15
{"id": "AU.VI", "farms": 48},
16
{"id": "AU.TS", "farms": 13},
17
{"id": "AU.QL", "farms": 136}
18
];
19
20
var map = anychart.map();
21
map.geoData(anychart.maps.australia);
22
23
// Creates the marker series
24
var series = map.marker(data);
25
26
//format the labels of the id-defined series
27
series.labels().format("{%name}");
28
29
series.tooltip().format("Id: {%id} \nSheep farms: {%farms}");
30
31
// hovered and selected labels
32
series.hovered().labels().fontColor("black");
33
series.selected().labels().fontColor("red");
34
35
map.title("Marker series on a map");
36
map.interactivity().zoomOnMouseWheel(false);
37
map.container("container");
38
map.draw();
39
});