Embed an OH3 chart into a Sitemap

Since the charting capabilities of OH3 are quite nice now: is it possible to include a chart into a basicui sitemap (maybe via a Webview just like Grafana)? It would also free us from having to use InfluxDB, Grafana etc. All-in-one OH3 solution.

1 Like

I would also like to be able to do this.

1 Like

I’m all but certain this is not and can not be supported given how the charting in MainUI works. In short, they are rendered in the browser, not on the server. So you’d have to figure out a way to run a separate browser as a service somewhere, create an API to call that server, and then that browser will navigate to the chart’s page, let the JavaScript render the chart, and then save it off somewhere.

In fact that’s what Grafana’s Image Renderer service does (there’s an instance of Chromium running in there). I can’t see anyone going through all that effort for OH though. But anyone is willing to try if they are up for a challenge.

It’s worth noting though that if you do want an all in one solution, HABPanel and MainUI both provide that for you. Sitemaps also have a built in charting ability with the Chart element. But the built in sitemap charting just isn’t as pretty or flexible as Graphana.

The Sitemap has a Webview component, which uses a UIWebView on iOS for example (= a fully fledged web browser, optionally even with Javascript). I assume it should be possible for such a Webview to render a Chart. I believe some Grafana+InfluxDB tutorials also suggest this way.