How select a timeperiod [1d|1w|1m] for Grafana Graph inside HabPanel?

Hi,
in the sitemap from BasicUI I “only” have this code and I can select between 4 time periods for the Grafana graph.

Switch item=Temperatures_Interval  label="Verbrauchsintervall Auswahl" icon="line" mappings=[1="4 Stunden",2="1 Tag",3="2 Tage",4="Woche",5="Monat",6="Jahr"]
 
Webview icon=weather url="http://192.168.zz.x:3000/d-solo/bGjjjxxxRz/klima?panelId=8&from=now-4h&tab=legend&refresh=2s\"  width=\"450\" height=\"300\" frameborder=\"0\"" height=14 visibility=[Temperatures_Interval == 1]
....

How can I realize a selection like this with Habpanel ?


I have no experience with manual created widgets (if this is needed), or is there a file like the sitemap-file to add code like this?
Has anyone an example or is there a widget I can use as “starting point” ?

Hi,
is there no chance to create this like in BasicUI?
Really hardcode every wanted time period and create link / pages to every graph (day, week, month, …) ?

Keep getting an error: invalid dimensions for plot, width=1028, height=0.
width value differs from 900-1028.
The plot only shows up when I refresh or click on the panel title → View

sitemap:

Frame label="Grafana selection chart" {
        Switch item=Grafana_Dropdown label="Grafana Dropdown: " icon=chart mappings=[1="2 Hours", 2="4 Hours",3="6 Hours",4="8 Hours"]
        Webview icon=line url="http://192.168.1.3:3000/d-solo/IM_GjMmRk/test-temp-and-humidity?orgId=1&panelId=2&from=now-2h&to=now&refresh=2s\" width=\"450\" height=\"300\" frameborder=\"0\"" height=10 visibility=[Grafana_Dropdown=="1"]
        Webview icon=line url="http://192.168.1.3:3000/d-solo/IM_GjMmRk/test-temp-and-humidity?orgId=1&panelId=2&from=now-4h&to=now&refresh=2s\" width=\"450\" height=\"300\" frameborder=\"0\"" height=10 visibility=[Grafana_Dropdown=="2"]
        Webview icon=line url="http://192.168.1.3:3000/d-solo/IM_GjMmRk/test-temp-and-humidity?orgId=1&panelId=2&from=now-6h&to=now&refresh=2s\" width=\"450\" height=\"300\" frameborder=\"0\"" height=10 visibility=[Grafana_Dropdown=="3"]
        Webview icon=line url="http://192.168.1.3:3000/d-solo/IM_GjMmRk/test-temp-and-humidity?orgId=1&panelId=2&from=now-8h&to=now&refresh=2s\" width=\"450\" height=\"300\" frameborder=\"0\"" height=10 visibility=[Grafana_Dropdown=="4"]
    }

Item:

//dummy virtual switch
String Grafana_Dropdown "Grafana Dropdown" 

Please help! I have been stuck on this for hours.

That quotemark doesn’t seem to have a partner.
Also seems a little odd to have some url parameters with & and some with space?

Hi,
I was actually trying to follow Martin’s (original post) syntax, who stated he got this working

I just check my sitemap, and yes, the \ seems correct.

The end from the URL-part is NOT after: refresh=2s;
it ends at: frameborder=0 (there are two quote marks, one with \, one without !)

So the syntax is correct!

But where your “really” problem is, no idea. For me it works as provided. Sorry.

1 Like

Yes I understand that. The alarm bells ring because quotes usually turn up in pairs, here we have an odd number of escaped quotes \"

What version of Grafana are you running?

I think an older(er) Version,
7.3.5