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 data = [
6
{id: 'AU.CT', value: 15, title: 'Australian Capital Territory'},
7
{id: 'AU.VI', value: 23, title: 'Victoria'},
8
{id: 'AU.WA', value: 86, title: 'Western Australia'},
9
{id: 'AU.QL', value: 16, title: 'Queensland'},
10
{id: 'AU.NS', value: 32, title: 'New South Wales'},
11
{id: 'AU.NT', value: 64, title: 'Northern Territory'},
12
{id: 'AU.TS', value: 28, title: 'Tasmania'},
13
{id: 'AU.SA', value: 45, title: 'South Australian'}
14
];
15
16
var map = anychart.map();
17
map.geoData(anychart.maps.australia);
18
map.choropleth(data);
19
map.title('Polygon selection is activated. Click the map to make it work.');
20
map.container('container');
21
22
// Render the map to the container.
23
map.draw();
24
25
map.startSelectPolygonMarquee(true);
26
27
// Set event type to change the drawing rectangle marquee
28
map.listen('selectPolygonChange', function (e) {
29
map.title('Polygon selection has been changed.');
30
});
31
32
map.listen('selectPolygonStart', function (e) {
33
map.title('Polygon selection drawing has been started.');
34
});
35
36
map.listen('selectPolygonFinish', function (e) {
37
map.title('Polygon selection is finished');
38
});
39
});