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 a stage
4
var stage = anychart.graphics.create("container");
5
6
// create data
7
var data = [170, 210, 130, 310];
8
9
// set the gauge type
10
linear = anychart.gauges.linear();
11
12
// set data for the gauge
13
linear.data(data);
14
15
// add the default pointer
16
linear.addPointer(0);
17
18
// set the size and position
19
linear.bounds(0, 0, "25%", "100%");
20
21
// set the container id
22
linear.container(stage);
23
24
// initiate drawing the gauge
25
linear.draw();
26
27
// set the gauge type
28
tank = anychart.gauges.tank();
29
30
// set data for the gauge
31
tank.data(data);
32
33
// add the default pointer
34
tank.addPointer(1);
35
36
// set the size and position
37
tank.bounds("25%", 0, "25%", "100%");
38
39
// set the container id
40
tank.container(stage);
41
42
// initiate drawing the gauge
43
tank.draw();
44
45
// set the gauge type
46
led = anychart.gauges.led();
47
48
// set data for the gauge
49
led.data(data);
50
51
// add the default pointer
52
led.addPointer(2);
53
54
// set the size and position
55
led.bounds("50%", 0, "25%", "100%");
56
57
// set the container id
58
led.container(stage);
59
60
// initiate the gauge drawing
61
led.draw();
62
63
// set the gauge type
64
thermometer = anychart.gauges.thermometer();
65
66
// set data for the gauge
67
thermometer.data(data);
68
69
// add the default pointer
70
thermometer.addPointer(3);
71
72
// set the size and position
73
thermometer.bounds("75%", 0, "25%", "100%");
74
75
// set the container id
76
thermometer.container(stage);
77
78
// initiate drawing the gauge
79
thermometer.draw();
80
});