Chart Help

I’m trying to set up a chart based on the demo information in the OH2 App. and demo sitemap.

When I run the OH2 app on my phone in Demo mode, it shows 1 single Chart Period that you can change by pressing Hour, Day, or Week. But I can not seem to mimic that in my own site map. When attempting, I always end up 3 charts showing up 1 below each other.

This is what I have done.

In my Site Map I have this:

Frame label="Weather" {
		Text item=Weather_Temperature valuecolor=[Weather_LastUpdate=="NULL"="lightgray",Weather_LastUpdate>90="lightgray",>25="orange",>15="green",>5="orange",<=5="blue"] {
			Frame {
				Text item=Weather_Temp_Max valuecolor=[>25="orange",>15="green",>5="orange",<=5="blue"]
				Text item=Weather_Temp_Min valuecolor=[>25="orange",>15="green",>5="orange",<=5="blue"]
				Text item=Weather_LastUpdate visibility=[Weather_LastUpdate>30] valuecolor=[Weather_LastUpdate>120="orange", Weather_LastUpdate>300="red"]
			}
			Frame {
				Switch item=gWeather_Chart_Period label="Chart Period" icon="chart" mappings=[0="Hour", 1="Day", 2="Week"]
				Chart item=gWeather period=h refresh=600 visibility=[gWeather_Chart_Period==0]
				Chart item=gWeather period=D refresh=900 visibility=[gWeather_Chart_Period==1, gWeather_Chart_Period=="NULL"]
				Chart item=gWeather period=W refresh=3600 visibility=[gWeather_Chart_Period==2]
			}
		}
	}

And my items information is

Group gWeather 	(All)

Number   Weather_Temperature    "Temperature [%.2f °F]"       (gWeather) {weather="locationId=home, type=temperature, property=current, unit=fahrenheit"}
Number   Weather_Temp_Min       "Temperature min [%.2f °F]"   (gWeather) {weather="locationId=home, type=temperature, property=min, unit=fahrenheit"}
Number   Weather_Temp_Max       "Temperature max [%.2f °F]"   (gWeather) {weather="locationId=home, type=temperature, property=max, unit=fahrenheit"}

I do have RRD4J persistence installed and I see the graphs charting the temps. But the SiteMap always shows the 3 charts tacked 1 after the other?

I never used that, but try to change the

Switch item=gWeather_Chart_Period label="Chart Period" ...

to

Selection item=gWeather_Chart_Period label="Chart Period" ...

Update: And I think you have to define gWeather_Chart_Period in an item file/via Paper UI. Did you do that?

Using either Switch or Selection gives the same result, and sitemap still shows/stacks all 3 charts one after the other.

I’m not sure if you need to define the gWeather_Chart_Period in an items file or now, and If that would be a Group or other type of item.

I’ve basically followed these steps here, but can’t get it show correctly with only 1 chart showing and changing as you select the Hour, Day, Week, etc.

How does your persist file look like?
Are setting the strategy for the group (using the * notation) ?

You must define gWeather_Chart_Period as a Number Item. You do not show that Item in what you pasted into your posting.

gWeather* : strategy = everyMinute, everyChange, restoreOnStartup

Yes, the Persist setting look good and I do see the temps showing on the chart. Its just that I can’t get the sitemap to correctly only show 1 chart that can change by choosing the Hour, Day, Week options. It keeps showing all 3 charts at the same time.

I also noticed in a Chrome Browser, the switch options do not appear either for the Hour, Day, Week, but rather a ‘normal’ switch shows.

Thank you. That is what I was missing and now it shows correctly.

I do also InfluxDB being used for persistence for energy monitoring. I may try and move this charting over to that soon. I need to relearn how to show a Grafana chart in OH2 though :slight_smile: