Hi,
I had a question on y-Axis scaling. If I want to set my own scaling for yAxis, how can I set the scale step. I can set the max value and min val by
yAxis.setMaximumAxisValue( maxScale );
yAxis.setMinimumAxisValue( minScale );
But how to set the step between two points?
Thanks.
Scaling y-axis
Re: Scaling y-axis
By default, the tick size on a number axis (or a date axis) is selected automatically from a collection of 'standard' tick sizes. The algorithm tries to display as many ticks as possible without the labels overlapping.
The TickUnits class is used to store the collection of 'standard' sizes. There is a default collection, but you can create your own collection, and then call the setStandardTickUnits(...) method if you want full control over the auto-tick-unit-selection mechanism.
Or, you can just override the automatic selection and specify a NumberTickUnit that always applies - use the setTickUnit(...) method in the NumberAxis class, something along these lines:
XYPlot plot = myChart.getXYPlot();
NumberAxis axis = (NumberAxis) plot.getRangeAxis();
axis.setTickUnit(myTickUnit);
In this case, you need to select a tick unit size that won't cause the labels to overlap.
Regards,
DG.
The TickUnits class is used to store the collection of 'standard' sizes. There is a default collection, but you can create your own collection, and then call the setStandardTickUnits(...) method if you want full control over the auto-tick-unit-selection mechanism.
Or, you can just override the automatic selection and specify a NumberTickUnit that always applies - use the setTickUnit(...) method in the NumberAxis class, something along these lines:
XYPlot plot = myChart.getXYPlot();
NumberAxis axis = (NumberAxis) plot.getRangeAxis();
axis.setTickUnit(myTickUnit);
In this case, you need to select a tick unit size that won't cause the labels to overlap.
Regards,
DG.
Re: Scaling y-axis
Thanks, it worked.
I set the scale unit using
axis.setTickUnit(myTickUnit);
I set the scale unit using
axis.setTickUnit(myTickUnit);