Get Date Range from Easy Chart after zoom

I found this post from 2008 (see link below). Support provided a Window that demonstrates pulling the current zoomed range out of any easy chart. I think it was done in FactoryPMI so I can't import the window into Ignition to test. Is there a different way to do this in Ignition or could I get a sample window to view the scripting?

Thanks

viewtopic.php?f=23&t=3722&p=6656

1 Like

Ok, I have made an Ignition backup of that window. It is a project backup so you can go into the designer and import it.

ChartZoomDemo_2013-02-22_1141.proj (21.7 KB)

For anyone looking for this, here’s the important ‘innards’ of that project export:

chart = event.source.parent.getComponent(“Easy Chart”)
jfChart= chart.getComponent(0).getComponent(0).getChart()
xAxis = jfChart.getPlot().getDomainAxis()

startDate = xAxis.getMinimumDate()
endDate = xAxis.getMaximumDate()

I found this and needed it to get the range on an easy chart while in either realtime or historical mode.
While in realtime, the End Date is set to

Very, helpful. Thanks!

2 Likes

Very helpful indeed. Only one small correction to Kraebring's post, the chart name should be single quotes ('Easy Chart'), not double quotes.

Actually, either. But if you copied and pasted from the above, you didn't get actual double quotes, but reformatted "curly" quotes. A side effect of the change in forum software in the intervening years.

Still happens if you don't mark pasted code as "preformatted text" with the proper comment editor button.

Thread from the dead (7 years), but might lead me down the correct path.

While I'm sure this was probably accurate information 7 years ago, this is no longer the best approach for getting the zoomed date range. We now have zoomedStartDate and zoomedEndDate fields directly on the chart component, so the solution is simply:

chartComponent = event.source.parent.getComponent('Easy Chart')
zoomedStartDate =  chartComponent.zoomedStartDate
zoomedEndDate = chartComponent.zoomedEndDate

Yes, thanks, I saw similar in another thread. Could you point me to where all the various properties are listed for a component, the Easy Chart in this case? I know I can hover over them in the property windows, but is there an actual document that we can see everything at a glance?

https://files.inductiveautomation.com/sdk/javadoc/ignition81/8.1.20/com/inductiveautomation/factorypmi/application/components/PMIEasyChart.html

The user manual, perhaps? And not just for this one Vision component.

https://docs.inductiveautomation.com/display/DOC81/Vision+-+Easy+Chart

I checked here before, but things like ZoomedStartDate are not listed

Thanks!