You’re absolutely right, rrd4j is not good for charting.
But this is not all, even without persisted states timeline should display the items without states. @Matt_Hias, after you change the persistennce, could you modify the url of the Webview element to include the full URL to your server?
Webview url=" http://address/static..."
Also, could you try that url directly from browser?
if I open the url in Firefox I get
TypeError: array is null in openHAB.js:55:21
For what its worth, objArray is null too.
Its the for loop of
// JSON to CSV Converter
function ConvertToCSV(objArray) {
var array = typeof objArray != ‘object’ ? JSON.parse(objArray) : objArray;
var str = ‘’;
for (var i = 0; i < array.data.length; i++) {
var line = '';
for (var index in array.data[i]) {
if (line !== '') line += ',';
line += array.data[i][index];
}
str += line + '\r\n';
}
return str;
}
I tried different items and groups and adjusted the persistence to “influx”
tracking it a bit further
jsonData = GetData(encodeURI(itemUrl));
fails with itemUrl being “…/…/…/rest/persistence/items/KG_Gaeste_Fenster?serviceId=influx”
The serviceId is appended by a ? in the URL where it should be a & (tested with Firefox mobile)
It only works for Contact items that return 0 or 1. I also have some that return “OPEN” and “CLOSED”, those fail to display completely. Same for groups with such a contact in it.
technical background: I run a wired Homematic system.
Input module HMW-Sen-SC-12-DR…#SENSOR returns open/closed
Input module HMW-IO-12-Sw14-DR…#VALUE returns 0/1
Actually, I had it working for Contact items with OPEN/CLOSED states… but apparently I didn’t upload the latest version .
Please, try and download again html.zip The only changed file is Timeline.html.
I’m not sure what you mean by that… The REST API clearly uses ? not &.
I’m not sure what you mean by that… The REST API clearly uses ? not &.
on march 7th you posted : Webview url="/static/.......?Item=timeline&serviceId=rrd4j" height=...
Please note that the html parameter list is started by ? but the parameter delimiter is & in your post. I found it working with ? as parameter delimiter.
Please, try and download again html.zip The only changed file is Timeline.html.
Actually, what I wrote is correct.
To transfer parameters to Timeline.html one has to use &. That’s why the Webview examples are given with &.
REST API, however, uses ? so, when Timeline.html queries the persistence it will append needed parameters with ?.
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 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 ?
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!!!
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.
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 .
So, here is what I accomplished:
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.
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.
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: