Reporting XY Chart dynamic axis bounds

Anyone who knows a way to dynamically set y-axis low and high bounds dynamically?
Can’t use auto range as the customer always want’s zero in the center of the chart and static values doesn’t work either.
Can set dynamic values to the x-axis just not the y-axes as these are set in the “Edit Axis” dialog and there’s no way (none I can find at least) to use dynamic values there.

Case of anyone in need of this, this is the solution for my problem. In the configureChart script, this code solves my problem. Also, I needed to mark 0.0, so this also adds a domain and range marker through 0.0 (couldn’t figure out how the Crosshair works :slight_smile:) .

from org.jfree.chart.plot import ValueMarker
from java.awt import Color, BasicStroke
	
plot = chart.getPlot()
rangeAxis = plot.getRangeAxis()

# Adding the domain and range markers (a crosshair) through 0.0
stroke = BasicStroke(1.0)
color = Color.LIGHT_GRAY
plot.addDomainMarker(ValueMarker(0, color, stroke))
plot.addRangeMarker(ValueMarker(0, color, stroke))

# Setting the new range.
newRange = max([rangeAxis.getUpperBound(), abs(rangeAxis.getLowerBound())]) + 10
rangeAxis.setRange(-newRange, newRange)
1 Like

I’m running into a similar issue except my chart has three different Y Axes. I need to set the upper bound of two of those dynamically. Those two have drastically different max values (one will be in the 10s (e.g. 20s, 30s, etc.) the other is typically less than 1 but greater than 0, but may be above 1).
I’m struggling as to how to access these two Axes in the Chart Script and set the Upper Bound values independently.
Anyone have any suggestions?