cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

Automatic refresh time interval in iChart

Former Member
0 Likes
172

Hi all,

we are using xMII 12.0.2 with an iChart display of tag items. The time interval default is set to "yesterday 6:00 - today 6:00".

Now the user wants to active the automatic refresh to see new data every minute (or so). If you activate automatic refresh, the default time interval is not used, but the time interval is set to "current time minus duration - current time".

Is there a possibility to let automatic refresh use the default interval? Say, if duration is 1 minute, and refresh rate is 1 minute, then date should be shown like "yesterday 6:01 - today 06:01", then next refresh "yesterday 6:02 - today 6:02" and so on.

Regards

Michael

Accepted Solutions (1)

Accepted Solutions (1)

jcgood25
Active Contributor
0 Likes

Michael,

Yes, you are seeing the expected behavior of the time engine, where enabling AutoRefresh will set the time window of the iChart (same would happen for a time based iGrid as well, since this happens at the query object level) using the effective 'Now' time on the webserver for the EndDate and the StartDate is the EndDate minus the Duration/DurationUnits settings. The AutoRefresh is attempting to make a real time trend for the most recent data from the data source itself.

To get your desired 1 minute rolling trend you can still leverage the time engine query parameters of StartDate and Duration/DurationUnits, but you will need to set them accordingly in JavaScript, possibly using the [setTimeout|http://www.w3schools.com/js/js_timing.asp] function for your timing. If you are currently using the Time parameter for Yesterday@06:00:00, with a Duration of 1 day, then make sure you set the Time parameter to "" before explicitly setting the StartDate and the subsequent .updateChart(true), since Time is prioritized over explicit dates.

It should be easy enough to do in JavaScript, and the standard time manipulation methods exposed at the base applet level should be helpful.

Best Regards,

Jeremy

Former Member
0 Likes

Jeremy,

thank you for your quick answer!

So I cannot use the build in autorefresh button in the iChart, but must create a JS button with your described fuctionality, and disable the iChart light bulb on the time control bar. That's what I was looking for. I hoped that it would work with an iChart customizing setting.

I will set up a function and come back when its working.

Regards

Michael

Former Member
0 Likes

Jeremy,

I have written a JavaScript function that uses the predefined dates and calculates the new display dates (old date/time + refresh rate) using the iChart.dateAdd function, calls updateChart, then starts a function that calls itself using the setTimeout JS function. The User can switch off the automatic trending with a button that calls clearTimeout.

However, we went back to the xMII builtin autoRefresh functionality. As you described, when activating autorefresh, xMII sets the end time to the current time. Then I set the duration to 24 hours, the refresh rate to 1 minute. Then everything works as the customer wanted.

Regards

Michael

Answers (0)