Page 1 of 1

Graph question

Posted: Monday 27 June 2022 19:58
by Pauls
Maybe somebody can help me with the following issue.
I have a simple graph for my P1 meter.
All works fine, but the week view shows the same value as my day value.
I would assume that for the week view, all the values of the 7 days will be added up?
Also the month and year does the same.
What am i doing wrong?

Code: Select all

//Stroom
blocks['graph_496'] = {
    title: 'Stroom verbruik',
    devices: [496],
    graph: ['bar','bar'],
    spanGaps: true,
    beginAtZero: [false, false],
    toolTipStyle: true,
    stacked: true,
    zoom: 'xy',
    custom : {
        "afgelopen 24 uur": {
		range: 'last',
        	groupBy: 'hour',
        	filter: '24 hours',
		data: {
                laag: 'd.v_496',
                hoog: 'd.v2_496',
	        }
	},
        "per dag": {
		range: 'month',
        	groupBy: 'day',
        	filter: '14 days',	   
		data: {
                laag: 'd.v_496',
                hoog: 'd.v2_496',
		}
        },
        "per week": {
            	range: 'month',
		groupBy: 'week',
		filter: '8 weeks',
		data: {
                laag: 'd.v_496',
                hoog: 'd.v2_496',
              }
        },
        "per maand": {
            	range: 'year',
		groupBy: 'month',
            	filter: '12 months',
            	data: {
                laag: 'd.v_496',
                hoog: 'd.v2_496',
              }
        },
	"per jaar": {
            	range: 'year',
		groupBy: 'year',
            	filter: '1 year',
            	data: {
                laag: 'd.v_496',
                hoog: 'd.v2_496',
             }
        }
    },
    legend: true, 
    datasetColors:['blue','red']
}

Re: Graph question

Posted: Thursday 30 June 2022 20:38
by Pauls
Hi guys,
Meanwhile searched the forum and the "show yours", but the graph code (blocks and config) shows the same.
Really nobody with the same problem (and hopefully the answer)?

Re: Graph question

Posted: Monday 04 July 2022 22:26
by Lokonli
Pauls wrote: Monday 27 June 2022 19:58 Maybe somebody can help me with the following issue.
I have a simple graph for my P1 meter.
All works fine, but the week view shows the same value as my day value.
I would assume that for the week view, all the values of the 7 days will be added up?
Also the month and year does the same.
What am i doing wrong?

Code: Select all

//Stroom
blocks['graph_496'] = {
    title: 'Stroom verbruik',
    devices: [496],
    graph: ['bar','bar'],
    spanGaps: true,
    beginAtZero: [false, false],
    toolTipStyle: true,
    stacked: true,
    zoom: 'xy',
    custom : {
        "afgelopen 24 uur": {
		range: 'last',
        	groupBy: 'hour',
        	filter: '24 hours',
		data: {
                laag: 'd.v_496',
                hoog: 'd.v2_496',
	        }
	},
        "per dag": {
		range: 'month',
        	groupBy: 'day',
        	filter: '14 days',	   
		data: {
                laag: 'd.v_496',
                hoog: 'd.v2_496',
		}
        },
        "per week": {
            	range: 'month',
		groupBy: 'week',
		filter: '8 weeks',
		data: {
                laag: 'd.v_496',
                hoog: 'd.v2_496',
              }
        },
        "per maand": {
            	range: 'year',
		groupBy: 'month',
            	filter: '12 months',
            	data: {
                laag: 'd.v_496',
                hoog: 'd.v2_496',
              }
        },
	"per jaar": {
            	range: 'year',
		groupBy: 'year',
            	filter: '1 year',
            	data: {
                laag: 'd.v_496',
                hoog: 'd.v2_496',
             }
        }
    },
    legend: true, 
    datasetColors:['blue','red']
}
Dashticz can't read your mind :)

By default Dashticz will assume you want to show the average of the grouped values. If you want to show the sum, add the following to the block definition:

Code: Select all

aggregate:'sum',

Re: Graph question

Posted: Monday 04 July 2022 22:35
by Lokonli
Lokonli wrote: Monday 04 July 2022 22:26
Pauls wrote: Monday 27 June 2022 19:58 Maybe somebody can help me with the following issue.
I have a simple graph for my P1 meter.
All works fine, but the week view shows the same value as my day value.
I would assume that for the week view, all the values of the 7 days will be added up?
Also the month and year does the same.
What am i doing wrong?

Code: Select all

//Stroom
blocks['graph_496'] = {
    title: 'Stroom verbruik',
    devices: [496],
    graph: ['bar','bar'],
    spanGaps: true,
    beginAtZero: [false, false],
    toolTipStyle: true,
    stacked: true,
    zoom: 'xy',
    custom : {
        "afgelopen 24 uur": {
		range: 'last',
        	groupBy: 'hour',
        	filter: '24 hours',
		data: {
                laag: 'd.v_496',
                hoog: 'd.v2_496',
	        }
	},
        "per dag": {
		range: 'month',
        	groupBy: 'day',
        	filter: '14 days',	   
		data: {
                laag: 'd.v_496',
                hoog: 'd.v2_496',
		}
        },
        "per week": {
            	range: 'month',
		groupBy: 'week',
		filter: '8 weeks',
		data: {
                laag: 'd.v_496',
                hoog: 'd.v2_496',
              }
        },
        "per maand": {
            	range: 'year',
		groupBy: 'month',
            	filter: '12 months',
            	data: {
                laag: 'd.v_496',
                hoog: 'd.v2_496',
              }
        },
	"per jaar": {
            	range: 'year',
		groupBy: 'year',
            	filter: '1 year',
            	data: {
                laag: 'd.v_496',
                hoog: 'd.v2_496',
             }
        }
    },
    legend: true, 
    datasetColors:['blue','red']
}
Dashticz can't read your mind :)

By default Dashticz will assume you want to show the average of the grouped values. If you want to show the sum, add the following to the block definition:

Code: Select all

aggregate:'sum',
And I see that groupBy:'year' doesn't work at the moment. I'll fix that.

Re: Graph question

Posted: Monday 15 August 2022 22:25
by Pauls
Thanks Lokonli,

I had added aggregate, but instead of "sum" i tried something like week or so.
Nevertheless, it's working now.
About the year bug, that will need a new dashticz version?