Re: [Experimental] New graph module. Testers needed.
Posted: Friday 13 September 2019 17:25
Could you post the resulting graph of the two previous steps? Just to check the results.
Open source Home Automation System
https://forum.domoticz.com/
This is the code i used:
Code: Select all
blocks['graph_903'] = {
graph: 'bar',
datasetColors: ['lightblue'],
legend: true,
custom : {
"last hours": {
range: 'day',
filter: '6 hours',
data: {
liter: 'd.v*100' }
},
"today": {
range: 'day',
filter: '12 hours',
data: {
liter: 'd.v*100' }
},
"last week": {
range: 'month',
filter: '7 days',
data: {
liter: 'd.v*1000' }
}
}
}
I adjusted the x-files but in the week graph is still shows 0:00. This is the same at the water usage graph and also at the power usage graph. By all the other graphs is is possible to adjust the x-values. I use range: month, filter 1 week.Lokonli wrote: ↑Friday 13 September 2019 23:13 It's documented:
https://dashticz.readthedocs.io/en/char ... the-x-axis
(Pull the latest version of the chartjs branch.)
Code: Select all
blocks['graph_903'] = {
graph: 'bar',
datasetColors: ['lightblue'],
legend: true,
custom : {
"last hours": {
range: 'day',
filter: '6 hours',
data: {
liter: 'd.v*100' }
},
"today": {
range: 'day',
filter: '12 hours',
data: {
liter: 'd.v*100' }
},
"last week": {
range: 'month',
filter: '7 days',
data: {
liter: 'd.v*1000' }
},
displayFormats: {
'hour': 'D MMM',
}
}
}
Thnk you again, it is working nowLokonli wrote: ↑Thursday 19 September 2019 20:11 You can change the time-format on the x-axis with the displayFormats setting. like:
The range 'month' provides only one measurement per day. I cannot change that: it's controlled by Domoticz.Code: Select all
blocks['graph_903'] = { graph: 'bar', datasetColors: ['lightblue'], legend: true, custom : { "last hours": { range: 'day', filter: '6 hours', data: { liter: 'd.v*100' } }, "today": { range: 'day', filter: '12 hours', data: { liter: 'd.v*100' } }, "last week": { range: 'month', filter: '7 days', data: { liter: 'd.v*1000' } }, displayFormats: { 'hour': 'D MMM', } } }
Since you filter 'just' 7 days, the chart.js module uses the 'hour' format. The default format for the hour format is 'H:mm'. That explains the '00:00' you see. By setting it to 'D MMM' you get the day/month label.
What I will do is modifying the default hour format to 'D MMM' in case the 'month' range is selected. For a month range is doesn't make sense to add the hour information, since we only get one measurement per day anyway,