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