This is a simple widget that lets you render pie charts in Dashing. It looks a little bit like this:
dashboard.erb
:
<li data-row="2" data-col="1" data-sizex="1" data-sizey="1">
<div data-id="links" data-view="Pie" data-title="Managed Links"></div>
</li>
my_job.rb
:
link_data = {}
link_types = ["Wired","Wireless","Wifi"]
SCHEDULER.every '2s' do
one = rand
two = ((1-one) * rand)
three = 1 - one - two
values = [one, two, three]
link_types.each_with_index do |link, i|
link_data[link] = { label: link, value: values[i]*100 }
end
send_event 'links', { value: link_data.values }
end
I hope you like it! If you have any questions/comments feel free to contact me at about.me/Jon.Koehmstedt
@claylevering although it was more than a year ago, your issue is you are sending the values as strings.
curl -d '{ "auth_token": "XXX", "value":[{"label":"Wired","value":10},{"label":"Wireless","value":15},{"label":"Wifi","value":75}]}' http://127.0.0.1:3030/widgets/Pie