- Platform information:
- Hardware: RP3
- OS: Linux 4.19.66-v7+ arm
- Java Runtime Environment: Temurin-11.0.15+10
- openHAB version: 3.3.0
- Issue of the topic: Configure a chart page to show a device status on a time x-axis and category y-axis.
Hi all,
I am really a big fan of the Apache ECharts provided with OH3. Every day I find some new possibilities and I am fully aware that the integration is not finished and will be better over time.
Currently I am struggeling with a layout that I would think should work but somehow does not.
I have a device status item which receives status values (integer 0-7) which can be mapped to some text status name (done in the binding).
So unluckily there is not a real good implemention of a timeline chart available so I thougth maybe I can simulate this with the charts available.
I tested my idea in ECharts Sandbox:
option = {
title: {
text: 'Betriebszustand'
},
tooltip: {
alwaysShowContent: true,
formatter: '{b0}: {c0}'
},
legend: {},
grid: {
left: '3%',
right: '4%',
bottom: '3%',
containLabel: true
},
xAxis: {
type: 'time'
},
yAxis: {
type: 'category',
data: ['Heizen','Warmwasser','Schwimmbad / Photovoltaik','EVU-Sperre','Abtauen','Keine Anforderung','Heizen ext. Energiequelle','KĂĽhlbetrieb']
},
series: [
{
name: 'Betriebszustand',
type: 'line',
data: [["2022-10-05 10:00", 0], ["2022-10-05 11:00", 1], ["2022-10-05 12:00",5], ["2022-10-05 13:00", 2]]
}
]
};
That actually works pretty fine with the following result:
So I tried to translate the JS configuration to the YAML like this:
config:
period: D
label: T_LWD70ARX_Betriebszustand
sidebar: false
slots:
grid:
- component: oh-chart-grid
config:
includeLabels: true
xAxis:
- component: oh-time-axis
config:
gridIndex: 0
yAxis:
- component: oh-category-axis
config:
gridIndex: 0
data:
- Heizen
- Warmwasser
- Schwimmbad / Photovoltaik
- EVU-Sperre
- Abtauen
- Keine Anforderung
- Heizen ext. Energiequelle
- KĂĽhlbetrieb
series:
- component: oh-time-series
config:
name: Betriebszustand
gridIndex: 0
xAxisIndex: 0
yAxisIndex: 0
type: line
areaStyle: {}
item: LWD70ARX_Betriebszustand
tooltip:
- component: oh-chart-tooltip
config:
confine: true
smartFormatter: false
formatter: "{b}: {c}"
legend:
- component: oh-chart-legend
config:
bottom: 3
type: scroll
dataZoom:
- component: oh-chart-datazoom
config:
type: inside
toolbox:
- component: oh-chart-toolbox
config:
show: true
presetFeatures:
- dataView
So my assumption was the the line in the YAML “item: LWD70ARX_Betriebszustand” will return an array of time / value pairs which maps to my data definition in the ECharts Sandbox.
But what ever I try the chart in OH stays empty. The Tooltip shows that the Category can not be matched “NaN” but the timestamp and value are there: (sorry only one screenshot for new users, I will pin it to the thread)
Maybe someone has an idea how to get this running or maybe an explanation why this will not work with the current implementation of ECharts in OH.
Really looking forward to your feedback!
Br
Sebash
P.S. not sure if it is the right forum category…