Most Dashing widgets require a job to pull information from the outside world. When data is pushed to a widget (with Curl for example), the past is usually lost and the new data is plotted / displayed.
I needed a widget that could have some memory of the past, and add the new pushed information to the past, not only display it.
To use this widget, copy activenumber.html
, activenumber.coffee
, and activenumber.scss
into the /widgets/activenumber
directory.
To include the widget in a dashboard, add the following snippet to the dashboard layout file:
<li data-row="1" data-col="1" data-sizex="1" data-sizey="1">
<div data-id="increment" data-view="Activenumber" data-title="Some Incremental Value"></div>
</li>
On it is installed, you can push new values by doing
curl -d '{ "auth_token": "YOUR_AUTH_TOKEN", "current": "10" }' \http://DASHING_HOST:DASHING_PORT/widgets/increment
Then "current" will be added to the previous value. Do it again and the value will increase each time.
Note that this does NOT survive a F5 / refresh of the dashboard.