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