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
var stage = anychart.graphics.create('container');
3
4
var palette = anychart.palettes.rangeColors();
5
palette.items(['#F44336', '#FFEB3B']);
6
palette.count(9);
7
8
// Get color by index.
9
var color = palette.itemAt(4);
10
11
for (var i = 1; i < 10; i++) {
12
var rect = stage.rect((i - 1) * stage.width() / 9, 0, stage.width() / 9 - .5, stage.height());
13
rect.fill(palette.itemAt(i));
14
rect.stroke('1px #000');
15
}
16
});