Page 1 of 1

yaxis scaling Dashticz custom graph

Posted: Tuesday 13 February 2024 21:12
by willemd
The yaxis scaling in a custom Dashticz graph does not work as expected.

I have a custom graph showing electricity usage of today (using range:day and filter:today).
Even though today's value does not exceed 3 kWh the yaxis scale goes up to 15 kWh, so the graph becomes rather meaningless.

I suspects this is because in one of the previous days the actual charge went up to 11 kWh because of EV charging and because I keep 7 days of detail history in domoticz.

I suspects the automatic scaling is based on values in range:day rather than on values in filter:today.

Is this something I can influence (without setting fixed scales of course) ?

Re: yaxis scaling Dashticz custom graph

Posted: Wednesday 14 February 2024 15:21
by willemd
Another example:

I have three gas devices added together showing gas usage in m3.
Hourly usage is max around 1 m3.
Daily usage is max around 10 m3.

Default yscale in daily graph (showing hourly values) is 70, default yscale on monthly graph (showing daily values) is 16.
So the scale on the daily graph again does not make sense.

How to solve?

Note: in the image included you will see that the daily graph (top graph) is now 10 instead of 70. This is because in the 7 day history a larger value dropped out. Still, 10 is still way too big.

Re: yaxis scaling Dashticz custom graph

Posted: Wednesday 14 February 2024 20:14
by Lokonli
Can you post your graph block definitions?

Re: yaxis scaling Dashticz custom graph

Posted: Thursday 15 February 2024 9:24
by willemd
This is the definition of the gas graph

Code: Select all

blocks['graph_gas_usage'] = {
    title: 'GAS usage',
    width: 12,
    devices: [87,88,89],
    customHeader: 'devices[2].CounterToday',
    graph: ['bar','bar','bar'],
    ylabels: ['m3','m3','m3'],
    beginAtZero: [true,true,true],
    custom: {
        "today": {
            range: 'day',
            filter: 'today',
            data: {
                hotwater: 'd.v_89',
                heating: 'd.v_87',
                cooking: 'd.v_88',
            }
        },
        "last month": {
            range: 'month',
            filter: '1 month',
            data: {
                hotwater: 'd.v_89',
                heating: 'd.v_87',
                cooking: 'd.v_88',
            }
         },
         "last 6 months": {
             range: 'year',
             filter: '6 months',
             data: {
                hotwater: 'd.v_89',
                heating: 'd.v_87',
                cooking: 'd.v_88',
             }
          }
    },
    datasetColors:['blue','red','green'],
    stacked: true,
    legend: true,
    height: '300px'
}

and this is the definition of the electricity graph

Code: Select all

blocks['graph_EL_usage'] = {
    title: 'Electricity usage',
    width:12,
    devices: [1,3,210],
    customHeader: 'devices[22].CounterToday',
    graph: ['line','bar','bar','bar','bar'],
    ylabels: ['kWh','kWh','kWh','kWh','kWh'],
    custom: {
        "today": {
            range: 'day',
            filter: 'today',
            data: {
                gridnett: 'd.v_1+d.v2_1-d.r1_1-d.r2_1',
                gridusage: 'd.v_1+d.v2_1',
                gridreturn: '-1*(d.r1_1+d.r2_1)',
                solar: 'd.v_3 + d.v_210',
                realusage: '-1*(d.v_3 + d.v_210 + d.v_1 + d.v2_1 -d.r1_1 - d.r2_1)',
           },
        },
        "last month": {
            range: 'month',
            filter: '1 month',
            data: {
                gridnett: 'd.v_1+d.v2_1-d.r1_1-d.r2_1',
                gridusage: 'd.v_1+d.v2_1',
                gridreturn: '-1*(d.r1_1+d.r2_1)',
                solar: 'd.v_3 + d.v_210',
                realusage: '-1*(d.v_3 + d.v_210 + d.v_1 + d.v2_1 -d.r1_1 - d.r2_1)',
            },
        },
        "last 6 months": {
            range: 'year',
            filter: '6 months',
            data: {
                gridnett: 'd.v_1+d.v2_1-d.r1_1-d.r2_1',
                gridusage: 'd.v_1+d.v2_1',
                gridreturn: '-1*(d.r1_1+d.r2_1)',
                solar: 'd.v_3 + d.v_210',
                realusage: '-1*(d.v_3 + d.v_210 + d.v_1 + d.v2_1 -d.r1_1 - d.r2_1)',
            },
        },
    },
    stacked: true,
    legend: true,
    height: '300px'
}

and here is the electricity graph ,today and last month

Re: yaxis scaling Dashticz custom graph

Posted: Thursday 15 February 2024 20:23
by Lokonli
You're correct. This is a bug. Your analysis is also correct. Thanks for reporting!

I'll fix this in a next beta. I'm working on an update of the graph module anyway. I'll include a fix for this as well.

As a work around, you can use the following.

Instead of:

Code: Select all

filter: 'today',
use

Code: Select all

filter: '1 today',

Re: yaxis scaling Dashticz custom graph

Posted: Thursday 15 February 2024 21:40
by willemd
Thanks, your workaround of using "1 today" works perfectly. Here is the result.

Re: yaxis scaling Dashticz custom graph

Posted: Saturday 02 March 2024 11:58
by NilsNijenhuis
Nice graph, i am tryng to use the same , but wat is the function of ?

Code: Select all

customHeader: 'devices[22].CounterToday',

Re: yaxis scaling Dashticz custom graph

Posted: Saturday 02 March 2024 20:07
by willemd
NilsNijenhuis wrote: Saturday 02 March 2024 11:58 Nice graph, i am tryng to use the same , but wat is the function of ?

Code: Select all

customHeader: 'devices[22].CounterToday',
Device 22 in my case displays the real total usage , which is the nett usage passed through the P1 meter plus the own Solar usage.