Get Easy Chart Axis Properties

I’m aware of the Axis datasets used for Easy Charts, but I’m curious if there’s some way to get an axis’ upper and lower bounds when the axis is set to auto range.

Thank you.

Not easily, no. But possible, thanks to its use of the JFreeChart library. The key is that an easychart contains a ChartPanel as its .chart property, which then contains a JFreeChart, which then contains a Plot. The Plot may or may have subplots, but at the lowest level, in the plot(s) you find Dataset, Range, and ValueAxis types containing the info you’re looking for. Keep in mind that the JFreeChart Dataset type is not the same thing as the Ignition Dataset type.
Also, if you use classic charts, they are direct subclasses of ChartPanel, skipping the need to access the .chart property.

1 Like

Thank you, Phil. This, along with another one of your posts explaining your “findJFChart” function were all that I needed. I appreciate the help.

2+ Thanks Phil

Your post reveals the JFree object hierarchy: ChartPanel > Chart > Plot

I wanted to turn off zoom in charts using setRangeZoomable() method of the chart panel.

In a propertyChange event handler, here is the code that works:

if event.propertyName == "data":
self = event.source
chart = self.getChart()
plot = chart.getPlot()

self.setRangeZoomable(False) # ChartPanel (JFreeChart 1.5.0 API)

1 Like

Has anyone accessed Range or ValueAxis properties described here?

I am just trying to read the Y-axis bounds of an Easy Chart so I can make my Report chart object the same values. I could easily write the Start and End Dates to Tags in Property Change scripts. Where are the Y-axis Upper and Lower Bound properties that I can read(after an Auto Range)?

I have some test code in the configureChart Extension function. I am having trouble accessing properties inside the Dataset of a Plot.

plot = chart.getPlot()
isSub = plot.isSubPlot()
dataset = plot.getDataset()
print dataset
system.gui.messageBox(str(chart)+"  "+str(dataset))

try str(dir(dataset)) in your messageBox().