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
3
// create data set on our data
4
var dataSet = anychart.data.set([38, 20]);
5
6
// set the gauge type
7
var gauge = anychart.gauges.linear();
8
gauge.data(dataSet);
9
10
// tank creating
11
var tankF = gauge.tank(0);
12
tankF.name("\xb0F");
13
tankF.color("#ed4830", 0.3);
14
tankF.width("10%");
15
16
var tankC = gauge.tank(1);
17
tankC.name("\xb0C");
18
tankC.offset("11%");
19
tankC.color("#ed4830");
20
tankC.width("10%");
21
22
// Set scale Celsius
23
var scale = gauge.scale();
24
scale.minimum(0);
25
scale.maximum(70);
26
scale.ticks().interval(5);
27
28
// Add axis with custom labels
29
var axis = gauge.axis(0);
30
axis.minorTicks(true);
31
axis.scale(scale);
32
axis.offset('-11%');
33
34
// set colors for empty parts of tanks
35
tankF.normal().emptyFill("#fbceb1");
36
tankF.hovered().emptyFill(anychart.color.lighten("#fbceb1"));
37
tankF.selected().emptyFill(anychart.color.darken("#fbceb1"));
38
tankC.normal().emptyHatchFill("percent05");
39
tankC.hovered().emptyHatchFill("percent25");
40
tankC.selected().emptyHatchFill("percent50");
41
42
// draw the chart
43
gauge.container("container");
44
gauge.draw();
45
});