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 chart = anychart.gauges.linear([15, 20, 25, 30, 44]);
3
4
var customColorScale = anychart.scales.ordinalColor();
5
customColorScale.ranges([
6
{less: 0.3},
7
{from: 0.3, to: 0.7},
8
{greater: 0.7}
9
]);
10
customColorScale.colors(['#F44336', '#2196F3', '#4CAF50']);
11
12
var scaleBar = chart.scaleBar();
13
scaleBar.from(0);
14
scaleBar.to(1);
15
16
// Set color scale.
17
scaleBar.colorScale(customColorScale);
18
19
chart.width(600).height(400);
20
chart.title('Set color scale');
21
chart.axis({offset: '-11%'});
22
chart.scale({minimum:0});
23
chart.container('container');
24
chart.draw();
25
});