Platform information: OH3
Issue of the topic:
Is it possible to smoothen the default charts like in the Analyze-Preview?
Analyze-Preview:
Default chart:
I´d like to have it as smooth as in the preview, even if I will loose some accuracy.
Is this possible?
I would be very interested in that, too. I tried to apply the smooth: true
property, but it didn’t work.
@ysc Is this something that is not implemented right now, or do we overlook something?
ysc
(Yannick Schaus)
January 5, 2021, 9:17pm
4
I tried smooth: true
half a year ago and it didn’t work either. Probably because it smoothes “between” the data points, but with openHAB/rrd4j those points are repeated even if the value doesn’t change. Don’t know yet if anything can be done.
ysc
(Yannick Schaus)
January 5, 2021, 9:39pm
5
So this is somewhat possible if you make a fixed period chart and sample every hour with an average aggregation function; to do this add a grid, a category X axis (for example Hours of day), a value Y axis, and an aggregate series with first dimension “Hour of Day”:
In YAML this is equivalent to this:
config:
chartType: day
slots:
grid:
- component: oh-chart-grid
config: {}
xAxis:
- component: oh-category-axis
config:
gridIndex: 0
categoryType: day
weekdayFormat: default
monthFormat: default
yAxis:
- component: oh-value-axis
config:
gridIndex: 0
series:
- component: oh-aggregate-series
config:
name: Series 1
gridIndex: 0
xAxisIndex: 0
yAxisIndex: 0
type: bar
item: FlowerCare_Temperature
dimension1: hour
You’ll get something like this:
Changing type: bar
to type: line
leads to this:
And then you can (in YAML only) add smooth: true
to the aggregate series so you get this:
Bonus: if you add another series with offsetAmount
& offsetUnit
you can show the previous day for comparison:
YAML for the above chart:
config:
chartType: day
slots:
grid:
- component: oh-chart-grid
config: {}
xAxis:
- component: oh-category-axis
config:
gridIndex: 0
categoryType: day
weekdayFormat: default
monthFormat: default
yAxis:
- component: oh-value-axis
config:
gridIndex: 0
series:
- component: oh-aggregate-series
config:
name: Today
gridIndex: 0
xAxisIndex: 0
yAxisIndex: 0
type: line
item: FlowerCare_Temperature
dimension1: hour
areaStyle:
opacity: 0.2
smooth: true
- component: oh-aggregate-series
config:
name: Yesterday
gridIndex: 0
xAxisIndex: 0
yAxisIndex: 0
type: line
item: FlowerCare_Temperature
dimension1: hour
offsetAmount: 1
offsetUnit: day
smooth: true
lineStyle:
opacity: 0.2
showSymbol: false
tooltip:
- component: oh-chart-tooltip
config:
show: true
legend:
- component: oh-chart-legend
config:
show: true
bottom: "10"
4 Likes
Thank you Yannis, this is working great. And the bonus with the comparison is much more than I ever expected.
peaeater
(Gerstl)
May 20, 2021, 5:34pm
7
Hello,
would it be possible to aggregate the series every 15 Minutes instead of every hour?
In the list this entry is missing. How can I append it?
I would need quarter hours of Day.