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},
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},
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(getData());
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 custom position for inside labels through the data set</span>');
31
32
// set the series
33
var series_1 = map.choropleth(data_1);
34
var series_2 = map.choropleth(data_2);
35
36
// enable labels
37
map.labels(true);
38
39
// set the overlapping mode for the map
40
map.overlapMode(false);
41
42
// set tooltips
43
series_1.tooltip().format("More women");
44
series_2.tooltip().format("More men");
45
46
// set the container
47
map.container('container');
48
map.draw();
49
});