Page 1 of 1

Use specific data in graphs

Posted: Sunday 21 October 2018 9:52
by moses123
Hello,

i used the graphs in dashticz to display the data of a weatherstation in the garden. It was anoying, that the value of the barometer ruined the graph. Because all three values where displayed on the same y-axis. In this case, the Temperature was no longer displayed properly, because of values 1000hpa to 1,2C.

So i changed the graph.js. Insert this before the line Morris.Line({

Code: Select all

    graphProperties=getChangedGraphProperties(idx,graphProperties);
And then change the custom.js like this:

Code: Select all

function getChangedGraphProperties(idx,graphproperties) {
        if (idx=432) {
                graphproperties.keys=["hu","te"];
        }
        return graphproperties;
}
The above example changed the displayed data from baro,temp and hum to temp and hum only, if the device is 432, which is my garden weather station.

If you changed the graphs.js, you have to insert at least this into custom.js:

Code: Select all

function getChangedGraphProperties(idx,graphproperties) {
       return graphproperties;
}
Maybe this is something do implement permanently to dashticz.


Moses123

Re: Use specific data in graphs

Posted: Sunday 21 October 2018 14:24
by moses123
I have forgotten the labels line:

Code: Select all

	if (idx=432) {
		graphproperties.keys=["hu","te"];
		graphproperties.labels=["%","°C"];
	}
Changing the if-part to this, shows the right format and appendix of the values in the hover-popup.

Re: Use specific data in graphs

Posted: Wednesday 24 October 2018 20:55
by ArthurNL
Interesting, but can't it to work like I want.

If I insert/change the code to the above, my graphs (or better, the plotted lines/data) of my Gas & Electra meters also disappear. It looks like it doesn't doesn't execute the (idx=xxx) part. It acts the same, even if I put an imaginary idx-number in it.

Re: Use specific data in graphs

Posted: Thursday 25 October 2018 6:45
by moses123
Hello,
post your code please.