Reputation: 35
I've got a little esp8266 temperature sensor network logging the temperature in different rooms to a raspberry pi. I'm then using dc.js (and crossfilter/d3) to render this as a multi series line chart. I have this working. What I can't work out is how I could then, for example, add a button for each room, which would turn the line for that room on/off on the chart.
I have set up a jsfiddle with what I have working so far https://jsfiddle.net/nts435ju/24/
You can see there are 3 rooms there. I'm pretty sure I need to use filtering on the roomdimension, but because I'm not sure how to do it given that it uses the [d.room, +d.timestamp]
array. The other thing I'd like to do is to be able to set up buttons to filter on say 'last week', 'last 48hrs', but again, can't quite work out how to do it.
Any help appreciated.
Upvotes: 1
Views: 824
Reputation: 35
I worked out how to do it. I just added a more simple room dimension to the crossfilter, filtered on that, and re-drew the chart. Updated jsfiddle
https://jsfiddle.net/nts435ju/25/
Upvotes: 1