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
set range of x axis
-
- JFreeChart Project Leader
- Posts: 11734
- Joined: Fri Mar 14, 2003 10:29 am
- antibot: No, of course not.
- Contact:
You can set the range manually:
Regards,
Dave Gilbert
Code: Select all
XYPlot plot = myChart.getXYPlot();
ValueAxis axis = plot.getDomainAxis();
axis.setRange(1.0, 24.0);
Dave Gilbert
set range on x-axis
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.
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.