Page 13 of 15

Re: Multiple sources in one graph

Posted: Sunday 01 March 2020 18:10
by clinkadink
EdwinK wrote: Sunday 01 March 2020 18:06 I've copy-ed the example from Sjonnie, and changed aboce line. I guess I need to change this in a variable.
Correct.

Re: Multiple sources in one graph

Posted: Sunday 01 March 2020 18:25
by EdwinK
clinkadink wrote: Sunday 01 March 2020 18:10
EdwinK wrote: Sunday 01 March 2020 18:06 I've copy-ed the example from Sjonnie, and changed aboce line. I guess I need to change this in a variable.
Correct.
Going to read up on that then

Re: Multiple sources in one graph

Posted: Sunday 01 March 2020 18:31
by clinkadink
EdwinK wrote: Sunday 01 March 2020 18:25 Going to read up on that then
You just have to change this ...

Code: Select all

blocks[grafiek_gas]
To this ... with quotes ...

Code: Select all

blocks["your_graph_name"] 
Then add this to the column ...

Code: Select all

columns[1]['blocks'] = [ "your_graph_name" ]

Re: Multiple sources in one graph

Posted: Sunday 01 March 2020 18:44
by Sjonnie2017
I am sorry that my somewhat strange way of defining blocks causes you problems.

Maybe this will help:

At the start of the config.js I define all my blocks. So for the "grafiek_gas" I have:

Code: Select all

var grafiek_gas                = 'graph_200';
Not sure if this will help but worth a try :)

Greetz,

Sjonnie

Re: Multiple sources in one graph

Posted: Sunday 08 March 2020 23:14
by Janco
Something I noted when experimenting with multiple sources in one graph: They tend to be very slow in loading on Android.

On MacOS and iOS there is hardly any speed loss, but on Android devices (phone and tablet) they can take up to thirty seconds to load (independent of the browser choice). While loading, the interface is completely frozen. Even the clock doesn't run.

Does anyone has any clue as to what could be the issue here?

Re: Multiple sources in one graph

Posted: Friday 15 May 2020 20:09
by JanvdW
clinkadink wrote: Sunday 23 February 2020 20:42 The GroupBy function will either:
  • The “sum” of all values together for that group
  • Provide the “average” of all values for that group
It identifies what type of sensor it is to apply to appropriate calculation.
  • Counter, Rain – uses the “Add’ calculation
  • Temperature, Custom Sensor and Percentage – uses the “Average” calculation
Is it possible to chose with a parameter if the sum or average calculation will be used for the GroupBy function? I think that there are lots of custom sensors where the sum of all values should be calculated instead of the average value.

In my case I wanted to use groupBy to summarize the values per day and month for my smart meter (gas and electricity), but it seems that the average values are presented. In first instance I didn't understood why the total amounts were not in the graph, but your post explains the reason.

Re: Multiple sources in one graph

Posted: Thursday 21 May 2020 21:37
by JanvdW
I have created a graph to display the energy costs (Euro) which are calculated by a dzvents script and stored in a set of custom sensors.

Code: Select all

blocks['graph_energiekosten'] = { devices: [164, 165, 166, 167, 168], title: 'Energiekosten', graph: ['line','line','bar','bar', 'line'], datasetColors:['red','yellow','#FF8A33','#FFBD33','green'], legend: true, custom : {
		"Dag": {range: 'day', data: { Gebruik: 'd.v_max_168', Netto: 'd.v_max_166', Stroom: 'd.v_max_164', Gas: 'd.v_max_165', Solar: '-d.v_max_167' } },
		"Maand": {range: 'month', data: { Gebruik: 'd.v_max_168', Netto: 'd.v_max_166', Stroom: 'd.v_max_164', Gas: 'd.v_max_165', Solar: '-d.v_max_167' } },
		"Jaar": {range: 'year', data: {  Gebruik: 'd.v_max_168', Netto: 'd.v_max_166', Stroom: 'd.v_max_164', Gas: 'd.v_max_165', Solar: '-d.v_max_167' } } } }
Image

There are some strange things in the graph which I do not understand:
1. In the day graph no data is presented at all
2.The sum values that are displayed on top of the graph are all '0.00 Euro'
3. The month and year graphs display the correct values, but (I believe this happened after the update to v3.4.8-beta) the values in the popo-up are rounded to whole numbers. The graph itself displays the correct values.

Re: Multiple sources in one graph

Posted: Thursday 21 May 2020 22:53
by Lokonli
JanvdW wrote:
clinkadink wrote: Sunday 23 February 2020 20:42 The GroupBy function will either:
  • The “sum” of all values together for that group
  • Provide the “average” of all values for that group
It identifies what type of sensor it is to apply to appropriate calculation.
  • Counter, Rain – uses the “Add’ calculation
  • Temperature, Custom Sensor and Percentage – uses the “Average” calculation
Is it possible to chose with a parameter if the sum or average calculation will be used for the GroupBy function? I think that there are lots of custom sensors where the sum of all values should be calculated instead of the average value.

In my case I wanted to use groupBy to summarize the values per day and month for my smart meter (gas and electricity), but it seems that the average values are presented. In first instance I didn't understood why the total amounts were not in the graph, but your post explains the reason.
Since beta 3.4.7 you can use the block parameter 'aggregate' for this, which can have value 'sum' or 'avg'.

Sent from my SM-A320FL using Tapatalk


Re: Multiple sources in one graph

Posted: Thursday 21 May 2020 23:40
by JanvdW
Lokonli wrote: Thursday 21 May 2020 22:53
JanvdW wrote:
clinkadink wrote: Sunday 23 February 2020 20:42 The GroupBy function will either:
  • The “sum” of all values together for that group
  • Provide the “average” of all values for that group
It identifies what type of sensor it is to apply to appropriate calculation.
  • Counter, Rain – uses the “Add’ calculation
  • Temperature, Custom Sensor and Percentage – uses the “Average” calculation
Is it possible to chose with a parameter if the sum or average calculation will be used for the GroupBy function? I think that there are lots of custom sensors where the sum of all values should be calculated instead of the average value.

In my case I wanted to use groupBy to summarize the values per day and month for my smart meter (gas and electricity), but it seems that the average values are presented. In first instance I didn't understood why the total amounts were not in the graph, but your post explains the reason.
Since beta 3.4.7 you can use the block parameter 'aggregate' for this, which can have value 'sum' or 'avg'.

Sent from my SM-A320FL using Tapatalk
I had missed this info; exactly what I was looking for. Thanks!

Re: Multiple sources in one graph

Posted: Thursday 21 May 2020 23:50
by Lokonli
JanvdW wrote:I have created a graph to display the energy costs (Euro) which are calculated by a dzvents script and stored in a set of custom sensors.

Code: Select all

blocks['graph_energiekosten'] = { devices: [164, 165, 166, 167, 168], title: 'Energiekosten', graph: ['line','line','bar','bar', 'line'], datasetColors:['red','yellow','#FF8A33','#FFBD33','green'], legend: true, custom : {
		"Dag": {range: 'day', data: { Gebruik: 'd.v_max_168', Netto: 'd.v_max_166', Stroom: 'd.v_max_164', Gas: 'd.v_max_165', Solar: '-d.v_max_167' } },
		"Maand": {range: 'month', data: { Gebruik: 'd.v_max_168', Netto: 'd.v_max_166', Stroom: 'd.v_max_164', Gas: 'd.v_max_165', Solar: '-d.v_max_167' } },
		"Jaar": {range: 'year', data: {  Gebruik: 'd.v_max_168', Netto: 'd.v_max_166', Stroom: 'd.v_max_164', Gas: 'd.v_max_165', Solar: '-d.v_max_167' } } } }
Image

There are some strange things in the graph which I do not understand:
1. In the day graph no data is presented at all
2.The sum values that are displayed on top of the graph are all '0.00 Euro'
3. The month and year graphs display the correct values, but (I believe this happened after the update to v3.4.8-beta) the values in the popo-up are rounded to whole numbers. The graph itself displays the correct values.
Graphs with range day probably dont have a max value, only the actual measurements. If you add debug:true to the graph block definition you get a debug button via which you can check the data.

Ill check the decimals.

Sent from my SM-A320FL using Tapatalk


Re: Multiple sources in one graph

Posted: Friday 22 May 2020 0:19
by Lokonli
Probably you have to add the block parameter 'decimals'

Sent from my SM-A320FL using Tapatalk


Re: Multiple sources in one graph

Posted: Friday 22 May 2020 0:37
by JanvdW
Fixed the issue with the values at the top of the graph with

Code: Select all

format: false
But decimals are still gone.

One additional question: the default graph is the first one (in my case it's 'Dag'). When I want to start with the month graph I have to change the button order in month, day, year. Which works, but is somewhat illogical. Can I define the default graph without changing the button order?

Re: Multiple sources in one graph

Posted: Saturday 23 May 2020 16:47
by Lokonli
JanvdW wrote: Friday 22 May 2020 0:37 Fixed the issue with the values at the top of the graph with

Code: Select all

format: false
But decimals are still gone.

One additional question: the default graph is the first one (in my case it's 'Dag'). When I want to start with the month graph I have to change the button order in month, day, year. Which works, but is somewhat illogical. Can I define the default graph without changing the button order?
In the latest beta I've created a little fix. You should be able to set the number of decimals via the 'decimals' block parameter.
See:
https://dashticz.readthedocs.io/en/beta ... st-changes

You can change the default graph by setting the 'range' parameter, which can be 'last', 'day' or 'month', or one of the custom graph names you have defined.

Re: Multiple sources in one graph

Posted: Saturday 23 May 2020 18:08
by JanvdW
Thanks for the update: that fixes the decimal issue!

I don't understand how I can change the default graph with the range parameter, without changing the button order. I have now the following code:

Code: Select all

blocks['graph_energiekosten'] = { devices: [168, 166, 164, 165, 167], title: 'Energiekosten', graph: ['line','line','bar','bar', 'line'], datasetColors:['red','yellow','#FF8A33','#FFBD33','green'], format: false, legend: true, custom : {
		"Dag": {range: 'day', debug: true, data: { Gebruik: 'd.v_168', Netto: 'd.v_166', Stroom: 'd.v_164', Gas: 'd.v_165', Solar: '-d.v_167' } },
		"Maand": {range: 'month', data: { Gebruik: 'd.v_max_168', Netto: 'd.v_max_166', Stroom: 'd.v_max_164', Gas: 'd.v_max_165', Solar: '-d.v_max_167' } },
		"Jaar": {range: 'year', groupBy: 'week', aggregate: 'sum', data: {  Gebruik: 'd.v_max_168', Netto: 'd.v_max_166', Stroom: 'd.v_max_164', Gas: 'd.v_max_165', Solar: '-d.v_max_167' } } } }
What do I need to change to make the month graph the default one?

Re: Multiple sources in one graph

Posted: Saturday 23 May 2020 20:11
by Lokonli
By adding range:'Maand' to the block definition, like this:

Code: Select all

 blocks['totenergy3'] = {
    range:'Maand',
    devices: [168, 166, 164, 165, 167],
    title: 'Energiekosten',
    graph: ['line', 'line', 'bar', 'bar', 'line'],
    datasetColors: ['red', 'yellow', '#FF8A33', '#FFBD33', 'green'],
    format: false,
    legend: true,
    custom: {
      Dag: {
        range: 'day',
        debug: true,
        data: {
          Gebruik: 'd.v_168',
          Netto: 'd.v_166',
          Stroom: 'd.v_164',
          Gas: 'd.v_165',
          Solar: '-d.v_167',
        },
      },
      Maand: {
        range: 'month',
        data: {
          Gebruik: 'd.v_max_168',
          Netto: 'd.v_max_166',
          Stroom: 'd.v_max_164',
          Gas: 'd.v_max_165',
          Solar: '-d.v_max_167',
        },
      },
      Jaar: {
        range: 'year',
        groupBy: 'week',
        aggregate: 'sum',
        data: {
          Gebruik: 'd.v_max_168',
          Netto: 'd.v_max_166',
          Stroom: 'd.v_max_164',
          Gas: 'd.v_max_165',
          Solar: '-d.v_max_167',
        },
      },
    },
  };

Re: Multiple sources in one graph

Posted: Saturday 23 May 2020 20:26
by JanvdW
Super; this works; thanks!

Re: Multiple sources in one graph

Posted: Monday 22 June 2020 19:57
by JanvdW
I noticed that there's a difference between the numbers in the graph and the numbers at the top as visualized in the graph below. I don't know why this happens. It seems that the numbers in the graph are lacking behind
Image

Re: Multiple sources in one graph

Posted: Thursday 13 August 2020 10:42
by Lokonli
JanvdW wrote: Monday 22 June 2020 19:57 I noticed that there's a difference between the numbers in the graph and the numbers at the top as visualized in the graph below. I don't know why this happens. It seems that the numbers in the graph are lacking behind
Image
Domoticz sends/stores the graph data with some delay, normally every 5 minutes. Dashticz requests the graph data with a certain interval. This will give some additional delay.

The numbers in the top are the actual data, which are updated almost instantaneous.

Re: Multiple sources in one graph

Posted: Saturday 19 December 2020 21:20
by JanvdW
I have some problems with one of my graphs. This graph displays the gas usage (bar) and the outside temperature (line) to see the correlation between gas usage and outside temperature. I work with the latest Domoticz (2020.2 (build 12705)) and Dashticz (3.7.1) versions. This is the block definition in Dashticz:

Code: Select all

blocks['graph_gas_gebruik'] = { range: 'Maand', devices: [127,63], title: 'Gasgebruik', graph: ['line','bar'], datasetColors: ['yellow','red',], legend: false, beginAtZero: [false, true] ,custom: {
	        "Dag": { range: 'day', data: { Temperatuur: 'd.te_63', Gas: 'd.v_127/12' } },
		"Maand": { range: 'month', data: { Temperatuur: 'd.te_63', Gas: 'd.v_127', } },
		"Jaar": { range: 'year', groupBy: 'month', aggregate: 'sum', data: { Temperatuur: 'd.te_63/30', Gas: 'd.v_127' } } } }
1. The value for 'd.te_63' is shown till November 29th, but starting from the 30th nothing is shown for temperature. In Domoticz the correct value is still there... So, I am lost.

2. For the day graph the gas value is far to high. When I divide this value by 12, it gives more or less the right value. I don't understand the reason why this happens.

3. For the year value I have used the aggregate parameter, but I can't choose for different operations per dataset. For the short term I have chosen to sum the values (which is right for gas) and divide the temp value by 30. I would like to choose the aggregate parameter per dataset. Is that possible?

Re: Multiple sources in one graph

Posted: Sunday 20 December 2020 17:25
by Lokonli
1)
Is that the case for all three graph types? (dag, maand, jaar)

2) That is indeed a bug.
Should be fixed in latest beta. Could you check?

It relates how data is requested from Domoticz for usage devices which are updated with a low frequency (like gas).
Other device types may be impacted as well (water usage?)

3)
I'll add an option to set aggregation per dataset.