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');
3
4
var gauge = anychart.circularGauge();
5
gauge.container(stage);
6
7
gauge.title(null)
8
.fill(null)
9
.stroke(null);
10
11
gauge.title().fontWeight('normal')
12
.fontFamily('Verdana')
13
.fontColor('#474747')
14
.fontSize('14px');
15
16
gauge.axis().labels().fontWeight('normal')
17
.fontFamily('Verdana')
18
.fontColor('#474747')
19
.fontSize('14px');
20
21
gauge.data([63]);
22
23
gauge.axis().scale()
24
.minimum(0)
25
.maximum(100)
26
.ticks({interval: 10})
27
.minorTicks({interval: 5});
28
29
gauge.axis()
30
.startAngle(270)
31
.fill('#929292')
32
.width(1)
33
.sweepAngle(270)
34
.ticks({type: 'trapezium', fill: '#474747', length: 10})
35
.minorTicks({type: 'trapezium', fill: '#474747', length: 4});
36
37
gauge.range(0, {
38
from: 55,
39
to: 70,
40
position: 'i',
41
fill: '#D96B2B',
42
stroke: '1 #000',
43
startSize: 4,
44
endSize: 4,
45
radius: 108
46
});
47
gauge.range(1, {
48
from: 70,
49
to: 100,
50
position: 'i',
51
fill: '#731728',
52
stroke: '1 #000',
53
startSize: 4,
54
endSize: 4,
55
radius: 108
56
});
57
gauge.needle()
58
.fill('#929292')
59
.stroke('1px rgba(2,2,2,.2)')
60
.startRadius('0%')
61
.endRadius('90%')
62
.middleRadius(0)
63
.startWidth('0.1%')
64
.endWidth('0.1%')
65
.middleWidth('5%');
66
67
gauge.cap()
68
.radius('10%')
69
.fill('#474747');
70
71
72
internalGauge = anychart.circularGauge();
73
internalGauge.container(stage);
74
75
internalGauge
76
.data([81])
77
.bounds('20%', '60%', '25%', '35%')
78
.fill('none')
79
.stroke('none');
80
81
internalGauge.axis()
82
.scale()
83
.minimum(0)
84
.maximum(100)
85
.ticks().interval(10);
86
87
internalGauge.axis().labels().fontWeight('normal')
88
.fontFamily('Verdana')
89
.fontColor('#474747')
90
.fontSize('10px');
91
92
internalGauge.axis()
93
.startAngle(180)
94
.fill('#474747')
95
.zIndex(0)
96
.labels();
97
98
internalGauge.axis().ticks({type: 'trapezium', fill: '#474747', length: 15});
99
100
internalGauge.needle()
101
.fill('#929292')
102
.stroke('1px rgba(2,2,2,.2)')
103
.startRadius('0%')
104
.endRadius('90%')
105
.middleRadius(0)
106
.startWidth('0.1%')
107
.endWidth('0.1%')
108
.middleWidth('5%');
109
110
internalGauge.cap()
111
.radius('10%')
112
.fill('#474747');
113
114
internalGauge.range(0, {
115
from: 75,
116
to: 95,
117
position: 'i',
118
fill: '#D96B2B',
119
stroke: '1 #000',
120
startSize: 6,
121
endSize: 6,
122
radius: 113,
123
zIndex: 1
124
});
125
internalGauge.range(1, {
126
from: 95,
127
to: 100,
128
position: 'i',
129
fill: '#731728',
130
stroke: '1 #000',
131
startSize: 6,
132
endSize: 6,
133
radius: 113,
134
zIndex: 1
135
});
136
137
gauge.draw();
138
internalGauge.draw()
139
});