forked from Mikhus/canvas-gauges
-
Notifications
You must be signed in to change notification settings - Fork 0
/
example.html
56 lines (52 loc) · 1.52 KB
/
example.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
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Gauge Test</title>
<script src="gauge.js"></script>
<style>body{padding:0;margin:0;background:#222}</style>
</head>
<body>
<p><input type="button" onclick="showGauge()" value="Show Gauge"></p>
<canvas id="gauge"></canvas>
<div id="console"></div>
<script>
function showGauge() {
var gauge = new Gauge({
renderTo : 'gauge',
width : 400,
height : 400,
glow : true,
units : 'Km/h',
title : false,
minValue : 0,
maxValue : 220,
majorTicks : ['0','20','40','60','80','100','120','140','160','180','200','220'],
minorTicks : 2,
strokeTicks : false,
highlights : [
{ from : 0, to : 50, color : 'rgba(0, 255, 0, .15)' },
{ from : 50, to : 100, color : 'rgba(255, 255, 0, .15)' },
{ from : 100, to : 150, color : 'rgba(255, 30, 0, .25)' },
{ from : 150, to : 200, color : 'rgba(255, 0, 225, .25)' },
{ from : 200, to : 220, color : 'rgba(0, 0, 255, .25)' }
],
colors : {
plate : '#222',
majorTicks : '#f5f5f5',
minorTicks : '#ddd',
title : '#fff',
units : '#ccc',
numbers : '#eee',
needle : { start : 'rgba(240, 128, 128, 1)', end : 'rgba(255, 160, 122, .9)' }
}
});
gauge.onready = function() {
setInterval( function() {
gauge.setValue( Math.random() * 220);
}, 1000);
};
gauge.draw();
};
</script>
</html>