How to get the X and Y axis value during in Zoom/Pan mode of Easy Chart

How to get the X and Y axis value/range during in Zoom/Pan mode of Easy Chart.
When we zoomed into a rectangle using mouse, how do we get the X axis (date-time) range and Y axis (value) range of that rectangle so that I can save that X/Y axis range and enter into that rectangle range easily? thanks in advance.

The date range can be obtained this way:

print event.source.getZoomedStartDate()
print event.source.getZoomedEndDate()

Thanks man for your helps. This will only get the date range(X-axis), however, would you tell me how can I get the value range (Y-axis)?

I'm not sure. What I can tell you is that I checked every method listed in the PMIEasyChart documentation, and so far, I have been unable to find it:
Just in case it could help you in some way, here is my cheat sheet for experimenting with the Easy Chart methods:

Code List
print 'getAppContext : '+str(event.source.getAppContext())
print 'getAutoColorList : '+str(event.source.getAutoColorList())
print 'getAxes : '+str(event.source.getAxes())
print 'getAxisLabelFont : '+str(event.source.getAxisLabelFont())
print 'getAxisTickLabelFont : '+str(event.source.getAxisTickLabelFont())
print 'getBarMargin : '+str(event.source.getBarMargin())
print 'getBoxFill : '+str(event.source.getBoxFill())
print 'getCalcPens : '+str(event.source.getCalcPens())
print 'getChartBorder : '+str(event.source.getChartBorder())
print 'getChartMode : '+str(event.source.getChartMode())
print 'getCursorCode : '+str(event.source.getCursorCode())
print 'getDatapoints : '+str(event.source.getDatapoints())
print 'getDataQuality: '+str(event.source.getDataQuality())
print 'getDateRange : '+str(event.source.getDateRange())
print 'getDateRangeBorder : '+str(event.source.getDateRangeBorder())
print 'getDateRangeLocation : '+str(event.source.getDateRangeLocation())
print 'getDateStyle : '+str(event.source.getDateStyle())
print 'getDigitalGap : '+str(event.source.getDigitalGap())
print 'getEditorBackgroundColor : '+str(event.source.getEditorBackgroundColor())
print 'getEditorForegroundColor : '+str(event.source.getEditorForegroundColor())
print 'getEffectivePollRate: '+str(event.source.getEffectivePollRate())
print 'getEmptyGroupName : '+str(event.source.getEmptyGroupName())
print 'getEndDate : '+str(event.source.getEndDate())
print 'getExtensionFunctions : '+str(event.source.getExtensionFunctions())
print 'getGapThreshold : '+str(event.source.getGapThreshold())
print 'getGlobalWhereClause : '+str(event.source.getGlobalWhereClause())
print 'getGridlineColor : '+str(event.source.getGridlineColor())
print 'getGridlineDashPattern : '+str(event.source.getGridlineDashPattern())
print 'getGridlineWidth : '+str(event.source.getGridlineWidth())
print 'getGroupWheres : '+str(event.source.getGroupWheres())
print 'gethGap : '+str(event.source.gethGap())
print 'getHGap : '+str(event.source.getHGap())
print 'getHighDensityColor : '+str(event.source.getHighDensityColor())
print 'getHistogramEndDate : '+str(event.source.getHistogramEndDate())
print 'getHistogramStartDate : '+str(event.source.getHistogramStartDate())
print 'getHorizontalResolution: '+str(event.source.getHorizontalResolution())
print 'getLegend : '+str(event.source.getLegend())
print 'getMaxSelectionSize : '+str(event.source.getMaxSelectionSize())
print 'getOuterRangeEnd : '+str(event.source.getOuterRangeEnd())
print 'getOuterRangeStart : '+str(event.source.getOuterRangeStart())
print 'getPenBorder : '+str(event.source.getPenBorder())
print 'getPenControlMode : '+str(event.source.getPenControlMode())
print 'getPens : '+str(event.source.getPens())
print 'getPlotBackground : '+str(event.source.getPlotBackground())
print 'getPlotOrientation : '+str(event.source.getPlotOrientation())
print 'getPlotOutlineColor : '+str(event.source.getPlotOutlineColor())
print 'getPollRate : '+str(event.source.getPollRate())
print 'getProperties : '+str(event.source.getProperties())
print 'getPropertiesLoading : '+str(event.source.getPropertiesLoading())
print 'getRtDateRange : '+str(event.source.getRtDateRange())
print 'getRtLabel : '+str(event.source.getRtLabel())
print 'getSelectedXValue : '+str(event.source.getSelectedXValue())
print 'getSelectionHighlight : '+str(event.source.getSelectionHighlight())
print 'getStartDate : '+str(event.source.getStartDate())
print 'getStartupRange : '+str(event.source.getStartupRange())
print 'getStartupSelection : '+str(event.source.getStartupSelection())
print 'getSubplotGap : '+str(event.source.getSubplotGap())
print 'getSubplots : '+str(event.source.getSubplots())
print 'getTagHistoryAllowInterpolation : '+str(event.source.getTagHistoryAllowInterpolation())
print 'getTagHistoryBypassCache : '+str(event.source.getTagHistoryBypassCache())
print 'getTagHistoryIgnoreBadData : '+str(event.source.getTagHistoryIgnoreBadData())
print 'getTagHistoryResolution : '+str(event.source.getTagHistoryResolution())
print 'getTagHistoryResolutionMode : '+str(event.source.getTagHistoryResolutionMode())
print 'getTagHistoryValidateScanclass : '+str(event.source.getTagHistoryValidateScanclass())
print 'getTagPens : '+str(event.source.getTagPens())
print 'getTickDensity : '+str(event.source.getTickDensity())
print 'getTimeStyle : '+str(event.source.getTimeStyle())
print 'getTitle : '+str(event.source.getTitle())
print 'getTitleFont : '+str(event.source.getTitleFont())
print 'getTodayIndicatorColor : '+str(event.source.getTodayIndicatorColor())
print 'getToolTipText : '+str(event.source.getToolTipText())
print 'getTrackMargin : '+str(event.source.getTrackMargin())
print 'getUnit : '+str(event.source.getUnit())
print 'getUnitCount : '+str(event.source.getUnitCount())
print 'getUtilityButtonSize : '+str(event.source.getUtilityButtonSize())
print 'getvGap : '+str(event.source.getvGap())
print 'getVGap : '+str(event.source.getVGap())
print 'getxAxisLabel : '+str(event.source.getxAxisLabel())
print 'getXAxisLabel : '+str(event.source.getXAxisLabel())
print 'getxAxisMargin : '+str(event.source.getxAxisMargin())
print 'getXAxisMargin : '+str(event.source.getXAxisMargin())
print 'getxOffset3D : '+str(event.source.getxOffset3D())
print 'getXOffset3D : '+str(event.source.getXOffset3D())
print 'getxTraceLargeNumberFormat : '+str(event.source.getxTraceLargeNumberFormat())
print 'getXTraceLargeNumberFormat : '+str(event.source.getXTraceLargeNumberFormat())
print 'getxTraceNumberFormatThreshold : '+str(event.source.getxTraceNumberFormatThreshold())
print 'getXTraceNumberFormatThreshold : '+str(event.source.getXTraceNumberFormatThreshold())
print 'getxTraceSmallNumberFormat : '+str(event.source.getxTraceSmallNumberFormat())
print 'getXTraceSmallNumberFormat : '+str(event.source.getXTraceSmallNumberFormat())
print 'getyOffset3D : '+str(event.source.getyOffset3D())
print 'getYOffset3D : '+str(event.source.getYOffset3D())
print 'getZoomedEndDate : '+str(event.source.getZoomedEndDate())
print 'getZoomedStartDate : '+str(event.source.getZoomedStartDate())

If I ever figure it out, I will let you know. See below

Edit: Updated documentation link

@June_Zhu - I finally figured this out. I was able to get all four parameter values in an easy chart from a test button using the following script:

chart = event.source.parent.getComponent('Easy Chart')
leftDomainX = chart.getZoomedStartDate()
rightDomainX = chart.getZoomedEndDate()
lowerRangeY =  chart.getComponent(0).getComponent(0).chart.getPlot().getRangeAxis().getLowerBound()
upperRangeY = chart.getComponent(0).getComponent(0).chart.getPlot().getRangeAxis().getUpperBound()
print "Current Y-Axis visible range = " + str(lowerRangeY) + " - " + str(upperRangeY)
print "Current X-Axis visible range = " + str(leftDomainX) + " - " + str(rightDomainX)

Output prior to zoom:
image

Current Y-Axis visible range = -0.1 - 200.0
Current X-Axis visible range = Tue Nov 08 20:00:00 CST 2022 - Wed Nov 09 20:59:59 CST 2022

Output after zoom:
image

Current Y-Axis visible range = 53.600332834 - 108.341278965
Current X-Axis visible range = Tue Nov 08 20:39:49 CST 2022 - Wed Nov 09 02:24:57 CST 2022
3 Likes

That is amazing!!! This really helps me a lots, very apprecite your helps!

1 Like

Probably want to fix your bookmarks to point to the v8.1.x javadocs instead of v7.8.

When exploring and you don't yet know where to look in the javadocs, you might find my introspection script helpful. (It has been around for a very long time.)

You can feed it pretty much any Ignition or java component or window or exotic object and it will point you in the right direction. You would do something like:

print inspect.introspect(chart)
print inspect.introspect(chart.subplots)

Et cetera. (Oh, lots of property shortcuts applicable to that cheat sheet code. Replacing getter/setter methods with the jython automatic property makes your code more efficient, and easier to read.)

4 Likes

Thanks, I have made the correction.
,

Double Thanks!
,

I made that post quite some time ago. If I remember correctly, I copied all of the get methods out of the docs, dumped them into a spreadsheet and did some fill down formula magic to automatically generate the exploratory code. This is not something I do anymore. It's amazing the effect six months of developing solutions to novel forum problems has had on the way I approach problems. For example, here are a couple of the things that I have learned along the way:
• ALWAYS resist the urge to script. Make a serious effort to find a built in solution first because often times there is one.
• Use dir() and look for built in properties that can be used in place of methods because they are more efficient.
• [...].getComponent(int) is unreliable for many components due to variations in the way a component can be configured. If a subcomponent must be obtained, use a recursive function to find it and return it.

This is my current cheat sheet for the base Easy Chart component:
Easy Chart_Map.txt (1.3 MB)

It'll be interesting to see how I do things years from now when I've been doing this for as long as you! Thanks again Mr. Turmel for your continuous guidance and instruction. It is genuinely appreciated.