How to hide the x-axis label periodically

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

How to hide the x-axis label periodically

Post by Peterson.Dalton » Tue Feb 10, 2004 8:40 am

Hi
I modified the LineChartDemo and create my own createDataset()method
It works fine.
//init mydata
Vector data = {"..."}
...
CategoryDataset createDataset(Vector data) {
//Read elements from Vector and addValue to the table
dataset.addValue(value,series,x-axis-label);
return dataset;
}

My question is that the lineChartDemo display all the x-axis-label
while I don't want so many.
I only need 1 every 5 x-axis labels displayed so that it would not seem too crowded.

eg.
the orginal x-axis
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15...>

what I expect
1----- 5-------10--->

Is there any method in the JFreeChar Libery to hide the extra x-axis label?Thank you.

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 » Tue Feb 10, 2004 10:02 am

If your x-axis contains numbers or dates, then you should use charts based on XYPlot rather than CategoryPlot. As a starting point, look at the createXYLineChart() method in the ChartFactory class.
David Gilbert
JFreeChart Project Leader

:idea: Read my blog
:idea: Support JFree via the Github sponsorship program

phamdinhnguyen
Posts: 22
Joined: Thu Jan 29, 2004 8:28 pm

Hiding the extra x-axis labels

Post by phamdinhnguyen » Mon Mar 01, 2004 7:01 pm

Seems I'm in need of similar task, as in:

http://www.jfree.org/phpBB2/viewtopic.p ... gory+label

Any suggestions? Thanks.

Locked