forked from Mikhus/canvas-gauges
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathofthen-updates.html
81 lines (71 loc) · 1.89 KB
/
ofthen-updates.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
<!doctype html>
<html>
<head>
<title>Car assist</title>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<style>body { padding: 0; margin: 0; background: #F0F0F0 }</style>
</head>
<body>
<p>
<canvas id="hpa"></canvas>
<canvas id="hpb"></canvas>
</p>
<script src="../gauge.min.js"></script>
<script>
var myHighlightsHP = [
{ from: 0, to: 40, color: 'rgba(0,0,255,.8)'},
{ from: 400, to: 450, color: 'rgba(255,0,0,.8)'}
];
var myMajorTicksHP = ['0', '100', '200', '300', '400', '450'];
var myCommonProp = {
width: 150,
height: 150,
value: 1,
colorPlate: '#F0F0F0',
colorMajorTicks: '#222',
colorMinorTicks: '#222',
colorTitle: '#222',
colorUnits: '#222',
colorNumbers: '#222',
colorNeedle: 'rgba(240, 128, 128, 1)',
colorNeedleEnd: 'rgba(255, 160, 122, .9)',
valueBox: false
};
var myAnimation = {
animationRule: 'decycle',
animationDuration: 500
};
var myCommonPropHP=Object.assign({},
myCommonProp,
myAnimation,
{
units:'BAR',
minValue:0, maxValue:450,
majorTicks:myMajorTicksHP,
highlights:myHighlightsHP
}
);
var hpaConfig = Object.assign({},
{ renderTo: 'hpa', title: 'HPA' },
myCommonPropHP
);
var hpbConfig = Object.assign({},
{ renderTo: 'hpb', title: 'HPB' },
myCommonPropHP
);
var gaugeHpa = new RadialGauge(hpaConfig);
var gaugeHpb = new RadialGauge(hpbConfig);
function onRender() {
console.log(this._value, this.value);
}
gaugeHpa.on('render', onRender);
gaugeHpb.on('render', onRender);
gaugeHpa.draw();
gaugeHpb.draw();
setInterval(function() {
gaugeHpa.value = 0;
gaugeHpb.value = 0;
}, 50);
</script>
</body>
</html>