I’m trying to script a seamless transition from a realtime trend to a manual trend, i.e. have the manual trend initialise with whatever current values are shown on the realtime trend.
I can get the current start date using:
trend = event.source.parent.getComponent('Trend')
startDate = trend.getZoomedStartDate()
And, if the realtime chart is paused, I can get the current end date using:
startDate = trend.getZoomedEndDate()
If the trend is not paused, though, the end date is “None”.
My two ideas are:
- If there’s a way to pause the chart using the script, I can pause it, then get the current end date, then switch modes. Is this possible?
- If there’s a way to detect within a script whether the chart is paused or not, I can use getZoomedEndDate() when it’s paused, and now() when it’s not paused. Is this possible? (side note - if I’m going to take this approach I need to work out how to convert the python “datetime.datetime.now()” into a java.util.date as I get an error when I try to do this currently. Advice on this one appreciated, although I suspect it’s more of a python/java question than an ignition question)
Open to any other ideas also.