I am trying to display a chart from a switch item in a custom widget.
All of the examples here on the forum are working for me, as long as the item I am displaying is “number”, none has worked for me so far using a Switch (ON/OFF) item.
Nothing is shown in the graph.
For OpenHab 3.2, what should I be using to display a switch item?
oh-aggregate-series
oh-time-series
to show in a day graph when switch was ON/OFF
I assume you mean that you want to see the on off area blocked off as in the default charts for switches. In that case you still use a time series. But you have to add to that series a mark area. I think you have to do this in the code tab, I don’t believe that there’s a UI wizard for this. It looks like this:
- component: oh-time-series
config:
name: On Off Block Series
gridIndex: 0
xAxisIndex: 0
yAxisIndex: 0
type: line
areaStyle: {}
slots:
markArea:
- component: oh-mark-area
config:
name: Some Label Here
item: Item_Name_Goes_Here
Many thanks for your reply. I was playing earlier around with the “oh-mark-area” with no success.
I have the feeling one little syntax error screws up the whole widget, here is what I have so far:
In the markArea itself, item: item is not meaningful. You need to have the name of an item set there. But I think the news is worse than that. It looks like you meant to have item: =props.item for that line, but I don’t think that will work. There are only some properties within the chart components that will accept expressions and I don’t think this is one of them. So, I don’t believe there is anyway to make the item of a mark area dynamic.