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
var map = anychart.map();
10
// data set for the choropleth series
11
var data_1 = [
12
{'id': 'AU.JB', 'value': 1.5, label: {x: 153, y: -33, positionMode: "absolute"}},
13
{'id': 'AU.NT', 'value': 2},
14
{'id': 'AU.WA', 'value': 3.2},
15
{'id': 'AU.NS', 'value': 2.7}
16
];
17
18
var data_2 = [
19
{'id': 'AU.CT', 'value': 1.12, label: {x: 7, y: 5, positionMode: "relative"}},
20
{'id': 'AU.SA', 'value': 2.9},
21
{'id': 'AU.VI', 'value': 3.86},
22
{'id': 'AU.QL', 'value': 1.1},
23
{'id': 'AU.TS', 'value': 1.6}
24
];
25
26
map.geoData("anychart.maps.australia");
27
28
// set the title and its preferences
29
map.title().useHtml(true).hAlign('center');
30
map.title('<span style="font-size: 14px;">Labels Settings</span><br><span style="font-size:12px;">Set the outside labels</span>');
31
32
// set the series
33
var series_1 = map.choropleth(data_1);
34
series_1.name("Men");
35
36
var series_2 = map.choropleth(data_2);
37
series_1.name("Women");
38
39
// enable labels
40
map.labels(true);
41
42
// set the tooltips
43
map.tooltip().format("More {%seriesName}");
44
45
// set the overlapping mode for the map
46
map.overlapMode(false);
47
48
// enable overlapping for the series
49
series_1.overlapMode("allow-overlap");
50
51
// set the container
52
map.container('container');
53
map.draw();
54
});