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 data_1 = [
10
{id: "AU.CT", value: 15},
11
{id: "AU.VI", value: 23},
12
{id: "AU.NT", value: 64},
13
{id: "AU.TS", value: 28},
14
{id: "AU.SA", value: 45}
15
];
16
17
var data_2 = [
18
{id: "AU.WA", value: 86},
19
{id: "AU.QL", value: 16},
20
{id: "AU.NS", value: 32}
21
];
22
23
24
var map = anychart.map();
25
map.geoData(anychart.maps.australia);
26
27
// create the color scale
28
var currentColorScale = anychart.scales.linearColor();
29
// Sets colors.
30
currentColorScale.colors(["#BDBDBD", "#424242"]);
31
32
// create the first series
33
var firstSeries = map.choropleth(data_1);
34
35
// create the second series
36
var secondSeries = map.choropleth(data_2);
37
38
// define the colorscale for both series
39
firstSeries.colorScale(currentColorScale);
40
secondSeries.colorScale(currentColorScale);
41
42
map.container("container");
43
map.draw();
44
});