Charts - How to scale them on different devices?


(Hallo Ween) #1

Hi,
i want to scale my charts, so that i can get more exact values on it.

I have a smartphone (galaxy note 4) and there i get very accurate charts with high resolution (sometimes too high resolution for the small screen). On my pc with 27" tft and 2500x1400 pixels i only get very poor resolution.

Can someone help my to set up the seetings in openhab.cfg correctly?

Here is my current setting:

################################## Chart Servlet ######################################
#
# This section defines the configuration for the chart servlet.
chart:provider=default

#
# Set the default height of a chart if the client doesn't provide this in the request
# defaults to 240
chart:defaultHeight=400

#
# Set the default width of a chart if the client doesn't provide this in the request
# defaults to 480
chart:defaultWidth=800

#
# Set a scale factor. This is used if the client sets the size in the request.
# defaults to 1 (ie no scaling)
chart:scale=1


Can someone explain me the functionality ot this settings? What do i have to change and what will be changed with this?

Here is what i get on my big 27" tft. It is very poor resolution for such a big (better than FULL HD) screen.

And this i get on my smartphone:


(Rich Koshak) #2

The charts are scaled automatically, you don’t really have any control over them.

You have a little more control if you use something like InfluxDB+Grafana to produce your charts, but you still face the problem that OH has no way to provide what amounts to a different sitemap to different devices.

One thing you can do though is use the visibility tag and a Switch with some buttons to manually select and show different versions of the chart. I have an example of this here

The bottom of the top posting on the InfluxDB+Grafana post also has a link to a JS library that lets you dynamically control the chart through webviews, though I’ve had zero success getting webviews to work in Habdroid.


(Hallo Ween) #3

I think, scale is the wrong word for that.

I want to get better resolution of the chart. See my two screenshots. The first one from the windows pc has only few lines in the chart and very thick graphs. The second screenshot has very much lines and very much more values on the sides of the charts. The chart is very thin.

But my computer screen has more resolution than my smartphone…

I can change this by editing the values in the openhab.cfg - i have postet my values above. With this i can change it, but i can´t find any manual how to do this and which thing i9 have to edit.

What is “chart:scale=1” ??? What can i change with this setting?


(Rich Koshak) #4

I understand the problem. But the problem still remains that openhab cannot tell what the resolution of your screen is to request a higher or lower resolution version of the chart based on your device. The Chart element on the sitemap doesn’t allow you to set the resolution of the images that get returned.

But you can set the resolution of the charts that get returned by Grafana. So what I was trying to get at with the links above is you would have a switch with MAPPINGS[Small=0, Medium=1, Large=2] buttons and three calls to Grafana with different resolutions and the visibility tag to switch between them.


(Hallo Ween) #5

If i change the values in the openhab.cfg, i will get a chart with higher or lower resolution, sometimes i get different chart on smartphone, but i can´t find an explanation of the settings in the openhab.cfg under “Charts”.

Do you know what this values will change on my openhab-charts?


(Rich Koshak) #6

I do not and in OH 2 those parameters no longer exist.


(ruslansv) #7

What is the equivalent of these parameters in OH2? Since there is no openhab.cfg - where to enter these parameters to change default chart dimensions?


(Rich Koshak) #8

Assuming these parameters are still valid for OH2, I would first try creating a chart.cfg file and include the above parameters without the leading chart:

I have no idea if these are still configurable.


(John Cocula) #9

I don’t think those parameters are valid in openHAB 2 yet. The current openHAB 2 chart servlet predates the one in openHAB 1.8.3, and my PR should fix that.


(Hallo Ween) #10

Was there a change recently? Yesterday i made a snasphot update of Openhab 2.3 to #1220 and now i get different charts inside habdroid. Before i was on a snapshot #1210 or something like this. Not to old. Only 2 weeks or so.

The charts are some kind of “ugly”. Black background and very big numbers on the scales.

Ok, before it was very very very small and the scales really unreadable (but nice charts), but now it looks like “ms dos” instead of “windows”.