forked from Mikhus/canvas-gauges
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcustom-002.html
96 lines (85 loc) · 2.78 KB
/
custom-002.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
<!doctype html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Gauge Test</title>
<link rel="stylesheet" href="../fonts/fonts.css">
<script src="../gauge.min.js"></script>
</head>
<body style="background: #fff">
<button onclick="animateGauges()">Animate</button>
<canvas id="canvasPressure"></canvas>
<script>
var gaugePressure = new RadialGauge({
renderTo: 'canvasPressure',
width: 300,
height: 300,
units: "1010 hPa",
startAngle: 70,
ticksAngle: 220,
colorPlate: "#ffffff",
colorUnits: "#3CA7DB",
colorNumbers: "#3CA7DB",
needleType: "arrow",
needleStart: 0,
needleEnd: 75,
needleWidth: 4,
needleCircleSize: 10,
needleCircleInner: false,
needleCircleOuter: true,
needleShadow: false,
colorNeedle: "#3CA7DB",
colorNeedleEnd: "#2698CE",
colorNeedleCircleOuter: "#3CA7DB",
colorNeedleCircleOuterEnd: "#3CA7DB",
// barWidth: 5,
// colorBarProgress: '#3CA7DB',
// colorBar: '#A8D3D5',
colorMajorTicks: ["#A8D3D5", "#ffffff", "#ffffff", "#ffffff", "#ffffff",
"#ffffff", "#ffffff", "#ffffff", "#ffffff", "#ffffff", "#ffffff", "#ffffff", "#ffffff", "#ffffff", "#A8D3D5"],
colorMinorTicks: "#ffffff",
// Вопрос в мин и макс значениях, при этих значениях анимация не работает
minValue: 975,
maxValue: 1045,
majorTicks: ["","980","","990","","1000","","1010","","1020","","1030","","1040",""],
minorTicks: "10",
strokeTicks: true,
highlights: [
{
"from": 974.75,
"to": 1045.25,
"color": "#A8D3D5"
}
],
//
highlightsWidth: 25,
numbersMargin: 12,
animation: true,
animationRule: "linear",
valueBox: false,
borders: false,
borderShadowWidth: 0,
value: 1010,
animateOnInit: true,
animatedValue: true
}).draw();
var timers = [];
function animateGauges() {
document.gauges.forEach(function(gauge) {
timers.push(setInterval(function() {
gauge.value = Math.random() *
(gauge.options.maxValue - gauge.options.minValue) +
gauge.options.minValue;
}, gauge.animation.duration + 50));
});
}
window.addEventListener('load', function() {
document.gauges.forEach(function(gauge) {
gauge.on('animate', function(percent, value) {
gauge.update({ units: parseInt(value, 10) + ' hPa' });
});
});
});
</script>
</body>
</html>