Increase the y axis

A discussion forum for JFreeChart (a 2D chart library for the Java platform).
Locked
Maria

Increase the y axis

Post by Maria » Wed Aug 07, 2002 8:52 pm

how can i increase the y axis manually.
For example, I have the following range:

min value = 0
max value = 2300

and i want to use the increment = 300.
For example again:

2300 --> max
2000
.
.
.
0900
0600
0300
0000 --> min

For default the increment is equals 100.

Thanks

Harald Faber

Re: Increase the y axis

Post by Harald Faber » Thu Aug 08, 2002 5:57 am

If my memory serves me right, this should be the NumberTickValue, but sorry, I have no example at hand, maybe later this morning.

Harald Faber

Re: Increase the y axis

Post by Harald Faber » Thu Aug 08, 2002 9:15 am

Here is the code I use:
CategoryPlot cp = (CategoryPlot)freeChart.getPlot();
NumberAxis na = (NumberAxis) cp.getRangeAxis();
na.setTickUnit(new NumberTickUnit(10.0, new java.text.DecimalFormat("###'%'")));

The NumberTickUnit(10.0, ...) is the relevant part where 10.0 is the step size. In your case I'd take 300.0 and the decimalFormat should be 0000 instead of my ###'%'. Note that you might want to save the old TickUnit in case you toggle between absolute and percent or so.

Let me know if it works (should).

Locked