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 tankPointer = chart.tank(3);
5
6
var state = tankPointer.normal();
7
8
// Set hatch fill for the empty part of a tank.
9
state.emptyHatchFill(function(){
10
if (this.index > 2) {
11
return {type: 'backward-diagonal', color: '#FFFFFF', thickness: 3};
12
} else if (this.index < 2)
13
return {type: 'forward-diagonal', color: '#FFFFFF', thickness: 3}
14
});
15
16
chart.width(600).height(400);
17
chart.title('Set state hatch fill parameter as a function');
18
chart.container('container');
19
chart.draw();
20
});