Multiple Data Sets in Graphs

Started by dale.s, August 06, 2015, 09:43:23 PM

dale.s

Im wondering if there is a easy way (ie, i dont have to redo a bunch of the scripts) to be able to show multiple data sets on one graph in the gateway. 
I have to following defined.
P1 : { name:'Probe 1', regexp:/p1\:([\d\.]+)/i, value:'', unit:'F', graph:1, graphOptions:{ lines: { show:true, fill:false, steps:false }, points: { show: true, radius: 2,  lineWidth:1 }, grid: { backgroundColor: {colors:['#000', '#a40']}}}},
  P2 : { name:'Probe 2', regexp:/p2\:([\d\.]+)/i, value:'', unit:'F', graph:1, graphOptions:{ lines: { show:true, fill:false, steps:false }, points: { show: true, radius: 2,  lineWidth:1 }, grid: { backgroundColor: {colors:['#000', '#a40']}}}},
  P3 : { name:'Probe 3', regexp:/p3\:([\d\.]+)/i, value:'', unit:'F', graph:1, graphOptions:{ lines: { show:true, fill:false, steps:false }, points: { show: true, radius: 2,  lineWidth:1 }, grid: { backgroundColor: {colors:['#000', '#a40']}}}},
 


Id love to be able to show all 3 graphs in one, is this possible with the default gateway?

Felix

Yeah it's also one of the things I've had on my feature list to add.
Not possible with the current code but it could be something I could code in for the future, I don't have an estimate right now.
One of the challenges of doing that is large sets of data. The more data you have the longer it takes to query it from a file database system like neDB. We could get fancy and use MySQL or others to achieve large data aggregation and fast data query via multiple indexing but that would make it less accessible and scriptable by the end user, which was one of my goals.

So ... to pull in 1 week worth of data that was logged every minute it can take up to 10 seconds. Overlap 2 graphs and it can take quite a bit more. Some people log data every few seconds. Then they complain when looking at 1 week of data takes too long.

Another shortcoming of these simple graphs is that I did not implement any aggregation. Ie if you look at a graph that is 800pixels on the screen, but it has 6400 data points, every pixel accounts for 8 data points, so its pointless to bring back that many points, we could simply aggregate each 8 points into a single data point that is an average or something along those lines. This was achieved by Timestore and implemented in PHP by the guys over at OpenEnergyMonitor which is another IoT management system.

So to come up with a nice fast solution I'd have to code something like Timestore on top of neDB but my gut feeling is neDB will become quite limited when it comes to large data sets. The point of neDB was the ease of use and the transparency of the data which is stored in plain text files that you can open in Notepad and look at, any time anywhere.

dale.s

Totally agree with everything you said.  While it would be a nice feature, i dont think its somthing you should put any serious work into considering 90% of people wouldn't need it, and it would add too much extra complexity for everybody else.

Felix

Yep I gave this quite a bit of thought.
I think it would make sense to make another page (like the log page) where you go in and can mix graphs from different nodes. That way this multi graph feature is not on the node/metric page but on a dedicated page where you can see graphs from more than just a single node - say you want to see the temperature in the attic vs the one in a bedroom below or vs the one in the garage and also throw in humidity or other things from various locations. Definitely a cool thing. I may give this idea a spin and see how neDB can handle it.

dirkdeb

Hi Felix,
This is definitely a useful feature and with your "new" data logging method  this could most probably be possible ?
Perhaps have an extra node/metric tickbox like "pin to main monitor". and save this with the other node settings in neDB ?
Perhaps have multiple graphs apart from  multiple data sets per graph on the same page ?


Felix

Yes, very useful, certainly on my todo list already :)

LukaQ

I hope, this is still a TODO, right?
Temp and humidity in one graph would be important for data correlation

EnMon

I also hope it's still on his to-do list.  ;D

Felix

Yes guys, it's still on the TODO, in fact I want this badly also, but I think there's a fair amount of work to put in to make it happen since I have other ideas to build on and this is dependent on those.
Have had almost no time lately for new gateway development, I hope that will change.

frix

Hi Felix!

Just curious if there's been any development on this multi-poll graph? I can always easily do it by requesting the CSVs, but it would be damn nice to have it within the gateway.

Cheers,
Oscar

Felix

Nothing in the works now. But its high in priority on my TODO.
Since this project is free and doesnt pay the bills, I have little time to dedicate to improvements, but always bugs are taken care of first, then features as I can get to them.
I hope in the next version to bring a few nice new features.