Timeline for Basic UI

Did I understand that right that I need to use ? for the browser

http://192.168.1.52:8080/static/Visualization/Timeline.html?Item=KG_Gaeste_Fenster?serviceId=influxdb

but & for the webview

webview url ="/static/Visualization/Timeline.html?Item=KG_Gaeste_Fenster&serviceId=influxdb" height = 4

In the first link, you are querying the persistence REST API directly, so, yes, you should use ?. That wonā€™t be of much use in a sitemapā€¦ I asked you to check if you can open the URL who was throwing the error just as a test.
On the second one, you are calling Timeline.html and you should specify the parameters with &.

I can display both Items now, open/close and 0/1.
Groups however no not work.

http://192.168.1.52:8080/static/Visualization/Timeline.html?Item=EG_Flur_Haustuer?serviceId=influxdb
works,
http://192.168.1.52:8080/static/Visualization/Timeline.html?Group=gdisplayFenster?serviceId=influxdb
does not.

items file reads:
Group gdisplayFenster

Contact EG_Flur_Haustuer ā€œTĆ¼rā€ (EG_Flur, gHaustuer,gdisplayFenster) {channel=ā€¦}

Using the REST API can you query persistence data for the group?
How do you persist the group?

I donā€™t. But gHaustuer is persisted. EG_Flur_Haustuer is a member gHaustuer. Since EG_Flur_Haustuer is the only member of gdisplayFenster I did not think that was a problem.

I was assuming that displaying the group concatenates all elements.
If i do persist the group in addition to its elements, does this result in twice the amount of data to be stored ?

If you use ServiceId=influxdb it works for Group and Item
If you use serviceId=influxdb it works for Item only

Canā€™t explain it. In Timeline.html it says
var serviceParameter = GetParameter(ā€œServiceIdā€);

In fact, if you use Item, you do not need any other parameter, just a ā€œ?ā€. Maybe it is then using the default persistence ?


This is the image I wanted to post further down, but the board woulnā€™t let meā€¦
Now its up here where it doesnā€™t belong.

Same for longer periods, the image seems to be inverted.

Hello, I implemented this function and I just love it! only a question, when I stop on a plotted area it shows the time in 12 am/pm format even though the timeline is in the correct 24 format. And i would also like to translate in Italian the duration and hours. Can i get a clue on how to do it?Thanks in advance, GREAT JOB!!!

This is odd. If i plot 192.168.1.52:8080/static/Visualization/Timeline.html?Group=heatingTimeline&ServiceId=influxdb&Hours=28 I get:

If I plot one more hour,
192.168.1.52:8080/static/Visualization/Timeline.html?Group=heatingTimeline&ServiceId=influxdb&Hours=29
I get all values inverted. I would love to post an image of it but this software wouldnā€™t let me. New users are so limitedā€¦
Edit: see two posts up.

Same for longer periods, the image seems to be inverted.

Hi guys!
Sorry for my late replyā€¦

@s0170071

I get all values inverted.

Iā€™m sorry, but I have no clue as why you are experience this. Iā€™m no web programmer and all I did was to modify @patrik_gfellerā€™s work with help from Google and other forums.
AFAIK, this Timeline visualization only plots state changes, so my guess is that you donā€™t have enough data in your persistenceā€¦ But, again, itā€™s only a guess. Iā€™m using this chart type in my sitemap and I didnā€™t have any problems with itā€¦

@Melkor
Well, I also wanted to make some modifications to the tooltip display and your question was just one more push for me to try something :smile:.
So, here is what I accomplished:

For translating the labels, you can take a look in Timeline.html and edit yourself the corresponding text (around line# 144):

					entry[2] = '<div class="ggl-tooltip">' +
						'<div><strong>' + label + '</strong></div>' +
						'<hr>' +
						'<table>' +
						'<tr><td><span>Start:</span></td><td>' + formatDate(entry[4],1) + '</td></tr>' +
						'<tr><td><span>End:</span></td><td>' + formatDate(entry[5],1) + '</td></tr>' +
						'</table><hr><table>' +
						'<tr><td><span>Duration:</span></td><td>' + duration_string + '</td></tr>' +
						'</table>' +
						'</div>';

For changing the datetime format, youā€™ll have to take a look at formatDate function (lines# 64-100). Choose another format and use it in the tooltipā€™s definition or modify to suit your need.
It shouldnā€™t be complicated at all.

I updated the previous link with the new version, but, in any case here it is again.
Files modified: Visualization\Timeline.html and css\visualizationStyle.css.

1 Like

All,

Thanks for this great feature. It improves my sitemap very much.

I discovered an issue with calculating the durations for the tooltip. The results always were less than 24h even if the state changes were longer than that. I have changed the calculation slightly to:

             var duration = Math.trunc((entry[5] - entry[4]) / 1000);
             var hours = parseInt( duration / 3600 );
             var minutes = parseInt( duration / 60 ) % 60;
             var seconds = duration % 60;

A second thing which seems to be nice to know for everyone is a way how to localize the timeline itself. When displaying a period longer than 24h the labels of the x-axis contain the abbreviations for the day. To streamline it with your local settings you can add the language option while loading the visualization package.

     google.charts.load("current", {
         packages: ["timeline"],
         language: "de"
     });
1 Like

Hi All off you
This looks absolutely awesome, but no way i can get it to work, I just get a ā€œwhiteā€ space,
tried with edge an Chrome, same thing, tried the bare url in the browser : (http://192.168.0.132:8080/static/Visualization/Timeline.html?Group=gBevegelse&serviceId=rrd4j&Hours=24)
The percistance works fine as i get the Chart with the same group to work fineā€¦

I downloaded Mihai_Badea html.zip, and changed the baseURL = ā€œhttp://192.168.0.132:8080/ā€ still nothingā€¦

Is it anything else i need to install to get this to work ?

/Ole

I had the exact same white-space-issue. What solved it for me was adding every single item I wanted to display into the rrd4j.persist file -instead of just the group:

Strategies {
		    everyMinute : "0 * * * * ?"
        	everyHour : "0 0 * * * ?"
        	everyDay  : "0 0 0 * * ?"
        	default = everyChange
			}
		    Items {
					timeline* : strategy = everyUpdate, everyMinute
                    timeline_item_1 : strategy = everyUpdate, everyMinute
                    timeline_item_2 : strategy = everyUpdate, everyMinute
                    [...]
			}

Remains the nagging feeling that it shouldnā€™t be necessary as it seems very redundant.

1 Like

@Huge_Go Did you make it in english?

Sorry,

But Iā€™m really busy and I couldnā€™t make it so far.

Thanks for your answer

maybe Some noob questions,

your help will me more than appreciated . you know the feeling to be close than ever :slight_smile:

1. Why do i have a such space (red square)?

    Text label="Security" icon="releaselock" {
        Frame label="Main" icon="alarm" {
                Selection item=HomeStatus icon="home"  label="Status"   mappings=[bye="Bye",lock="Lock",night="Night",back="Back",door="Door"]
                Default item=gpresence_Notification label="Last motion"					
                //myStr= Z_Door1 + " " +Z_Door1_LastUpdate
                Default item=DoorProxy_terrasse						 label="Terrace [%s]"	icon="door"
                Default item=Z_Door1_LastUpdate  label="Last update" icon="time" 
                Default item= mqtt_sensor_door label="Entry Door" icon="door"    
               // Default item= mqtt_sensor_door_LastUpdate label="Last update"  icon="time" 
                
                Default item= mqtt_sensor_door_LastUpdate1     
                Default item= mqtt_sensor_door_LastUpdate2     
                Default item= mqtt_sensor_door_LastUpdate3     
                Default item= mqtt_sensor_door_LastUpdate4     
                Default item= mqtt_sensor_door_LastUpdate5     
                Default item= mqtt_sensor_door_LastUpdate6     
                Default item= mqtt_sensor_door_LastUpdate7     
                Default item= mqtt_sensor_door_LastUpdate8     
                Default item= mqtt_sensor_door_LastUpdate9  	
                Default item= mqtt_sensor_door_LastUpdate10  	
                Webview url="/static/Visualization/Timeline.html?Item=mqtt_sensor_door&ServiceId=influxdb&Hours=12" height=12

                Default item=Door_Snooze_Switch						 label="Door_Snooze_Switch"	icon="door"

        }
    }

2. is it possible to change the font color or the X axis (currently black on black?

  1. Correct me if i am wrong. this widget could be displayed only when connected to the local network AND only from a browser

Guys, any ideas?

Please I would like to see this example! Thanks!!

1 Like

Hello,
I want to access a sitemap containing timeline through a nginx reverse-proxy.
The local access ā€œhttp://adress:8080/basicui/app?sitemap=diagnosticā€ works fine,
but when I try to access this site through a nginx-reverseproxy
ā€œhttps://adress.tld/basicui/app?sitemap=diagnosticā€ the timline dosnt appear.
Which changes are required to acces timline through a reverseproxy?