forked from jorgemorgado/dashing-barchart
-
Notifications
You must be signed in to change notification settings - Fork 0
/
my_barchart_job.rb
29 lines (26 loc) · 890 Bytes
/
my_barchart_job.rb
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
source = 'http://some.remote.host/barchart.xml'
labels = ['January', 'February', 'March', 'April', 'May', 'June', 'July']
SCHEDULER.every '10s', :first_in => 0 do |job|
send_event('barchart', {
data: {
labels: labels,
datasets: [
{
label: 'My First dataset',
fillColor: 'rgba(220,220,220,0.5)',
strokeColor: 'rgba(220,220,220,0.8)',
highlightFill: 'rgba(220,220,220,0.75)',
highlightStroke: 'rgba(220,220,220,1)',
data: Array.new(labels.length) { rand(40..80) },
}, {
label: 'My Second dataset',
fillColor: 'rgba(151,187,205,0.5)',
strokeColor: 'rgba(151,187,205,0.8)',
highlightFill: 'rgba(151,187,205,0.75)',
highlightStroke: 'rgba(151,187,205,1)',
data: Array.new(labels.length) { rand(40..80) },
}
]
}
})
end