Oh-chart, especially oh-category-axis stopt working after update to OH 5.2

I have the below oh-chart, which worked fine up to and including OH 5.1. With the update to OH 5.2. I don’t get any x-axis labels anymore (rest is still fine). The markline vanished as well, this is most probably caused by the previous issue.

          - component: oh-chart
            config:
              period: 3D
            slots:
              grid:
                - component: oh-chart-grid
                  config:
                    bottom: 10%
                    containLabel: true
                    left: 0%
                    right: 0%
                    top: 7%
              legend:
                - component: oh-chart-legend
                  config:
                    bottom: 0
              series:
                - component: oh-data-series
                  config:
                    data: =JSON.parse(items['open_meteo_forecast'].state).hourly.diffuse_radiation_instant
                    gridIndex: 0
                    markLine:
                      data:
                        - xAxis: =Number((items.Vir_Uhrzeit.displayState).split(":")[0])
                      lineStyle:
                        color: gray
                        type: dashed
                        width: 1
                      silent: true
                      symbol:
                        - none
                        - none
                    name: Indirekt
                    type: line
                    xAxisIndex: 0
                    yAxisIndex: 0
                - component: oh-data-series
                  config:
                    data: =JSON.parse(items['open_meteo_forecast'].state).hourly.direct_radiation_instant
                    gridIndex: 0
                    name: Direkt
                    type: line
                    xAxisIndex: 0
                    yAxisIndex: 0
              xAxis:
                - component: oh-category-axis
                  config:
                    axisLabel:
                      formatter: =value=>value.split("T")[1].split(":")[0]
                    data: =JSON.parse(items['open_meteo_forecast'].state).hourly.time
                    gridIndex: 0
              yAxis:
                - component: oh-value-axis
                  config:
                    gridIndex: 0

I’m not 100% sure this is spec compliant or break is simply caused due to my setup?!

Changing the oh-category-axis as below, ends up in getting the x-axis back. But it looks like the data string is not executed, but rather taken as a string. I would expect this behavior just without the equal sign ..

                - component: oh-category-axis
                  config:
                    categoryType: values
                    data: =JSON.parse(items['open_meteo_forecast'].state).hourly.time
                    gridIndex: 0

Thanks a lot for any hint!

Probably helpful to mention the reasoning on the change above ..

With the initial setup, i lost x-axis labels.

To simplify setup, i next removed the formatter, as it’s more or less just a beautifier.

No change, x-axis labels still not visible.

In between i revisited the oh-category-axis specs and recognized the categoryType as mandatory.

What matches my needs is the “values” parameter, with the results described above.

Setting categoryType to “day” works fine for x-axis labels, but as the name suggests, just a single day shows up in the chart.

I aim to have 3 days ..

Maybe to break down even more ..

Has anybody managed to compile a widget with oh-chart and dynamic (fed by external data) x-axis?

I have never tried to do this so I can’t say directly, but based on the current code it looks like the category axis will only read the data property if categoryType is set to values

I don’t know, but this may also have changed between 5.1 and 5.2 during the big UI refactor to typescript which is why you are getting a different behavior with your update.

Thanks a lot for your feedback!

I wonder whether this is really such a rare use case ..

I could imagine grabbing any external time series data with uncertain time baundaries would require such a construct.

Right now it’s not super important, just unpractical, hence i’ll watch out whether this issue get’s more attention.

Backup might be to get a grafana chart in instead.

It’s worth trying to create an issue in openhab-webui. It might be an unintended consequence of refactoring that can easily be “fixed”.

I can confirm, with above mentioned changes chart works again as expected with OH 5.2.1.
Thanks to the team!