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': 300}, // Western Australia
11
{'id': 'AU.JB', 'value': 270}, // Jervis Bay Territory
12
{'id': 'AU.NS', 'value': 240}, // New South Wales
13
{'id': 'AU.VI', 'value': 75}, // Victoria
14
{'id': 'AU.NT', 'value': 130}, // Northern Territory
15
{'id': 'AU.TS', 'value': 190}, // Tasmania
16
{'id': 'AU.CT', 'value': 100}, // Australian Capital Territory
17
{'id': 'AU.SA', 'value': 280}, // South Australia
18
{'id': 'AU.QL', 'value': 220} // Queensland
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("Bi-polar progression with Ordinal Color Scale");
27
28
// set the series
29
var series = map.choropleth(data);
30
31
// set the colors and ranges for the scale
32
series.colorScale(anychart.scales.ordinalColor([{less:200},{from:200, to:250},{greater:250}]));
33
34
//set the single hue progression
35
var colors = anychart.color.bipolarHueProgression('#EC6E07', '#64B5F6', 3);
36
37
// series disable
38
series.stroke("2 gray 0.41");
39
40
// define the colors
41
series.colorScale().colors(colors);
42
43
// create, enable and stroke the colorRange
44
var colorRange = map.colorRange();
45
colorRange.enabled(true).stroke('#BBB');
46
47
// set the container
48
map.container('container');
49
map.draw();
50
});