I have a chart that displays the number of completed tasks versus time. On the Y axis, 0 and a fixed value are always turned on, which will be the maximum number of tasks. Over time, the series line rises to its maximum value. I can do it all.
What I want to do is let the user switch between the Y axis going from 0 to MAX and 0 to the auto range value. Thus, they can only be increased according to the data and should not have the upper half of the graph empty if they are still far from the maximum value.
JFreeChart chart = ChartFactory.createTimeSeriesChart("", "", "Progress", dataset, false, true, false); XYPlot plot = chart.getXYPlot(); plot.getRangeAxis().setRange(new Range(0, TOTAL), false, true);
This line allows me to display the entire range of values, but I canβt get the range back to the automatic value, which sets the upper limit only higher than the largest value in the series (the way it will be displayed if you do not set the range at all).
source share