Set the range of horizontal axis

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

Set the range of horizontal axis

Post by Fabien Boulesteix » Wed Nov 15, 2000 9:12 am

Hello,
I would like not to see all the label of an horizontal axis.
Actually, I have a VerticalBarChart with 30 values on the X axis. Those values come from a database. When I see the graph, It looks like "200120022003". Is it possible to change the range of the X axis so I see only one value per three (i.e. "2001 2004 2005")?

David Gilbert

RE: Set the range of horizontal axis

Post by David Gilbert » Thu Nov 16, 2000 12:10 am

You can't skip any category labels on the axis. You could modify the code so that it leaves some labels out...I didn't include anything because I couldn't think of a general way to implement it.

The best you can do is use "vertical labels", which gives you more room for extra categories. There should be a method in HorizontalCategoryAxis (for some reason I forgot to add it):

public void setVerticalCategoryLabels(boolean flag) {
this.verticalCategoryLabels = flag;
this.notifyListeners(new com.jrefinery.chart.event.AxisChangeEvent(this));
}

Hope that helps.

DG.

Locked