I've got to write my own zooming method in a XYPlot using TimeSeries. Therefore, I want to simulate y-axis zooming by simply doubling the axis range.
The problem is that I want to have the axis tick units stay at exactly the same position and same distance to each other...
If defined a range for the axis by using setRange() and did set a custom tickUnit, resulting in the desired image on start of the program. However, if I change the settings for the axis during runtime by setting a larger Range and picking a larger tickunit, the position of the first tickunit does unfortunately not stay at the same position.
Instead, the axis shifts its ticks...
I'm using this code:
Code: Select all
adding data ...
NumberAxis rangeAxis = new NumberAxis();
rangeAxis.setRange(startY, endY);
double range = rangeAxis.getUpperBound() - rangeAxis.getLowerBound();
rangeAxis.setTickUnit(new NumberTickUnit(range / 10.0, numberFormatter));
... mapping sets etc.
But if I change startY and endY during runtime, the first tick moves away.
I've checked the settings in the axis after everthing was drawn and it its range is correct... So the problem has to lie somewhere within the tickhandling.
Thanks for reading and I would be happy to hear from you.
Cheers Christopher