yaxis scaling Dashticz custom graph

Dashticz, alternative dashboard based on HTML, CSS, jQuery

Moderators: leecollings, htilburgs, robgeerts

Post Reply
willemd
Posts: 629
Joined: Saturday 21 September 2019 17:55
Target OS: Raspberry Pi / ODroid
Domoticz version: 2024.1
Location: The Netherlands
Contact:

yaxis scaling Dashticz custom graph

Post 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) ?
willemd
Posts: 629
Joined: Saturday 21 September 2019 17:55
Target OS: Raspberry Pi / ODroid
Domoticz version: 2024.1
Location: The Netherlands
Contact:

Re: yaxis scaling Dashticz custom graph

Post 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.
Attachments
Untitled-2.jpg
Untitled-2.jpg (70.52 KiB) Viewed 1421 times
Lokonli
Posts: 2271
Joined: Monday 29 August 2016 22:40
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

Re: yaxis scaling Dashticz custom graph

Post by Lokonli »

Can you post your graph block definitions?
willemd
Posts: 629
Joined: Saturday 21 September 2019 17:55
Target OS: Raspberry Pi / ODroid
Domoticz version: 2024.1
Location: The Netherlands
Contact:

Re: yaxis scaling Dashticz custom graph

Post 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
Attachments
Untitled-1.jpg
Untitled-1.jpg (70.19 KiB) Viewed 1405 times
Lokonli
Posts: 2271
Joined: Monday 29 August 2016 22:40
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

Re: yaxis scaling Dashticz custom graph

Post 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',
willemd
Posts: 629
Joined: Saturday 21 September 2019 17:55
Target OS: Raspberry Pi / ODroid
Domoticz version: 2024.1
Location: The Netherlands
Contact:

Re: yaxis scaling Dashticz custom graph

Post by willemd »

Thanks, your workaround of using "1 today" works perfectly. Here is the result.
Attachments
Screenshot 2024-02-15 213826.jpg
Screenshot 2024-02-15 213826.jpg (85.78 KiB) Viewed 1385 times
NilsNijenhuis
Posts: 81
Joined: Friday 10 July 2020 22:56
Target OS: NAS (Synology & others)
Domoticz version:
Contact:

Re: yaxis scaling Dashticz custom graph

Post by NilsNijenhuis »

Nice graph, i am tryng to use the same , but wat is the function of ?

Code: Select all

customHeader: 'devices[22].CounterToday',
willemd
Posts: 629
Joined: Saturday 21 September 2019 17:55
Target OS: Raspberry Pi / ODroid
Domoticz version: 2024.1
Location: The Netherlands
Contact:

Re: yaxis scaling Dashticz custom graph

Post 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.
Post Reply

Who is online

Users browsing this forum: No registered users and 0 guests