set range of x axis

A discussion forum for JFreeChart (a 2D chart library for the Java platform).
Locked
jacobo
Posts: 2
Joined: Fri Mar 14, 2003 5:27 pm

set range of x axis

Post by jacobo » Fri Mar 21, 2003 5:33 pm

Hi, I want to customize the x axis of my chart. I want to paint a range between 1 to 24. Jfreechart automatic paint a range of 0 to 25.
How I can do it.
Thanks for all
Thanks fol all

david.gilbert
JFreeChart Project Leader
Posts: 11734
Joined: Fri Mar 14, 2003 10:29 am
antibot: No, of course not.
Contact:

Post by david.gilbert » Mon Mar 24, 2003 9:59 pm

You can set the range manually:

Code: Select all

XYPlot plot = myChart.getXYPlot();
ValueAxis axis = plot.getDomainAxis();
axis.setRange(1.0, 24.0);
Regards,

Dave Gilbert

Meenu
Posts: 3
Joined: Tue Mar 25, 2003 2:33 pm

set range on x-axis

Post by Meenu » Wed Mar 26, 2003 5:16 am

I have tried this code

XYPlot plot = myChart.getXYPlot();
ValueAxis axis = plot.getDomainAxis();
axis.setRange(1.0, 24.0);

but this code is not working with lineChart , because linechart plot is CategoryPlot not XYPlot. It is giving notCompatiablePlot Exception.

Locked