This is a simple widget that lets you render pie charts in Dashing. Forked from stevenleeg/pie.coffee 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="bookmarks_frequency" data-view="Fullpie" data-title="Bookmark freq."></div>
</li>
my_job.rb
:
data = [
{ label: "Label1", value: 16 },
{ label: "Label2", value: 34 },
{ label: "Label3", value: 10 },
{ label: "Label4", value: 40 },
{ label: "Label5", value: 20 },
]
send_event 'bookmarks_frequency', { value: data }
I hope you like it!
I found a fix for the widget being empty on page refresh (IE not using existing data)
Rename the render function to renderPie, and change the onDraw call to call renderPie
It appears that the base widget code has a function call render (very hard to find any docs on Dashing.Fullpie) so renaming the function stops the code from hiding the base render code, and things work as expected, and an onDraw call occurs on page load.