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
// create choropleth map
3
var map = anychart.choropleth();
4
5
// set map geo data
6
map.geoData(anychart.maps.world_source);
7
8
// create color scale
9
var scale = anychart.scales.ordinalColor();
10
scale.colors(['#81d4fa', '#4fc3f7', '#29b6f6', '#039be5', '#0288d1']);
11
12
// create choropleth series and setup color scale
13
var series = map.choropleth(worldDefaultDataSet);
14
series.colorScale(scale);
15
16
// set container id for the map
17
map.container('container');
18
19
// initiate chart drawing
20
map.draw();
21
});