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([
3
{value: 15},
4
{value: 20},
5
{value: 25},
6
{value: 30},
7
{value: 44}
8
]);
9
chart.bar(2);
10
11
// Enable scale bar.
12
chart.scaleBar(0, true);
13
14
chart.scaleBar(0, {from: 25, to: 40, fill: '#E0E0E0'});
15
chart.scaleBar(1, {
16
from: 23, to: 27, points: [
17
{height: 0, left: 1, right: 0},
18
{height: 0.5, left: 0, right: 0},
19
{height: 1, left: 1, right: 0}
20
], offset: '10%', fill: '#F44336'
21
});
22
23
chart.axis(0, {offset: '-11%'});
24
25
chart.scale().minimum(0);
26
chart.scale().maximum(50);
27
28
chart.title('Enable scale bar by index');
29
chart.container('container');
30
chart.draw();
31
});