How to customize what's displaying in the Y-axis

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

How to customize what's displaying in the Y-axis

Post by Linh Nguyen » Tue Jun 04, 2002 10:21 am

Hi,
I want my Y-axis to be formatted Y-value %. I know I have to use NumberTickUnit, but I don't know how to create the NumberFormat that is nedded to create the NumberTickUnit object.
Thanks, Linh

David Gilbert

Re: How to customize what's displaying in the Y-axis

Post by David Gilbert » Tue Jun 04, 2002 3:31 pm

Try something like this:

XYPlot plot = myChart.getXYPlot();
NumberAxis axis = (NumberAxis)plot.getRangeAxis();
NumberTickUnit unit = new NumberTickUnit(1.0, new java.text.DecimalFormat("0.00%"));
axis.setTickUnit(unit);

Regards,

DG.

Locked