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 = [
10
{'id': 'AU.WA', 'value': 320},
11
{'id': 'AU.JB', 'value': 270},
12
{'id': 'AU.NS', 'value': 240},
13
{'id': 'AU.VI', 'value': 75},
14
{'id': 'AU.NT', 'value': 130},
15
{'id': 'AU.TS', 'value': 190},
16
{'id': 'AU.CT', 'value': 100},
17
{'id': 'AU.SA', 'value': 280},
18
{'id': 'AU.QL', 'value': 220}
19
];
20
21
// create map
22
var map = anychart.map();
23
map.geoData(anychart.maps.australia);
24
25
// set the title and its preferences
26
map.title("Blended progression with Linear Color Scale");
27
28
// set the series
29
var series = map.choropleth(data);
30
31
// stroke disable
32
series.stroke("2 white 0");
33
34
// set the colors and ranges for the scale
35
series.colorScale(anychart.scales.linearColor());
36
37
//set the single hue progression
38
var colors = anychart.color.blendedHueProgression('#C8F672', '#273813');
39
40
// define the colors
41
series.colorScale().colors(colors);
42
43
// enable the colorRange
44
map.colorRange(true);
45
46
// set the container
47
map.container('container');
48
map.draw();
49
});