I want to change one value on the X-Axis of a graph from an integer to String.
I have ...
xAxis1.setRange(20.0, 200.0);
xAxis1.setTickMarksVisible(true);
Instead of X-Axis showing 20, 40, 60, 80..... it should be 20, 40, "zero degree", 80 etc.
I am not sure whether trying out with Tick units is the right method. I tried
NumberAxis rangeAxis = (NumberAxis)plot1.getRangeAxis();
rangeAxis.setStandardTickUnits(TickUnits.createIntegerTickUnits());
but then it allows only a createIntegerTickUnits() rather than create your own integer+string tick units.
Can anyone suggest a way out?
Tick units/X Axis
Re: Tick units/X Axis
The tick labels are generated numerically, so what you are trying to do isn't straightforward. But one possibility would be to subclass the HorizontalNumberAxis class and override the refreshTicks method...after the collection of ticks is populated, you could write some code to replace certain values.
Regards,
DG
Regards,
DG