-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbulletgraph.coffee
67 lines (62 loc) · 1.52 KB
/
bulletgraph.coffee
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
class Dashing.Bulletgraph extends Dashing.Widget
onData: () ->
# Handle incoming data
data = @get('dataset')
settings = []
upper = 0.3
i = 0;
while i < 3 and dataset1[i] != null
obj = {
type: 'indicator'
mode: 'number+gauge+delta'
value: data[i].current
delta: reference: data[i].last
domain:
x: [
0.25
1
]
y: [
0.1 + upper * i
0.3 + upper * i
]
title: text: data[i].title
gauge:
shape: 'bullet'
axis: range: data[i].range
threshold:
line:
color: data[i].lineColor
width: 2
thickness: 0.75
value: data[i].thresholdValue
steps: [
{
range: data[i].badRange
color: data[i].badRangeColor
}
{
range: data[i].mediumRange
color: data[i].mediumRangeColor
}
{
range: data[i].goodRange
color: data[i].goodRangeColor
}
]
bar: color: data[i].barColor
}
i++
settings.push obj
layout =
width: 750
height: 300
paper_bgcolor:"#40b2f1"
margin:
t: 10
r: 25
l: 25
b: 10
config =
responsive: true
Plotly.newPlot gd, settings, layout, config