I am afraid you have to modified the code of JfreeChart, Is Opensource great?
I have this problem before for my BarChart, What I did is to customize the tick on x-Axis
I only implemented this for CategoryAxis.java alone. I hope this can shed some light on you.
Please note the variable "tickInterval", I added this property to the class,
for example you have 1000 numbers, if set tickInterval as 99, only
0, 100, 200, 300 ... will show up.
bye the way, my freechart version is 1.0.5
public List refreshTicks(Graphics2D g2,
AxisState state,
Rectangle2D dataArea,
RectangleEdge edge) {
List ticks = new java.util.ArrayList();
// sanity check for data area...
if (dataArea.getHeight() <= 0.0 || dataArea.getWidth() < 0.0) {
return ticks;
}
CategoryPlot plot = (CategoryPlot) getPlot();
List categories = plot.getCategoriesForAxis(this);
double max = 0.0;
if (categories != null) {
CategoryLabelPosition position
= this.categoryLabelPositions.getLabelPosition(edge);
float r = this.maximumCategoryLabelWidthRatio;
if (r <= 0.0) {
r = position.getWidthRatio();
}
float l = 0.0f;
if (position.getWidthType() == CategoryLabelWidthType.CATEGORY) {
l = (float) calculateCategorySize(categories.size(), dataArea,
edge);
}
else {
if (RectangleEdge.isLeftOrRight(edge)) {
l = (float) dataArea.getWidth();
}
else {
l = (float) dataArea.getHeight();
}
}
int categoryIndex = 0;
Iterator iterator = categories.iterator();
while (iterator.hasNext()) {
Comparable category = (Comparable) iterator.next();
if(categoryIndex>0 && tickInterval>0)
{
if((categoryIndex+1) % (tickInterval+1) > 0)
{
category = "";
}
}
TextBlock label = null;
if(tickInterval> 0)
{
label = this.createSingleLabel(category, l * r, edge, g2);
}
else
{
label = createLabel(category, l * r, edge, g2);
}
if (edge == RectangleEdge.TOP || edge == RectangleEdge.BOTTOM) {
max = Math.max(max, calculateTextBlockHeight(label,
position, g2));
}
else if (edge == RectangleEdge.LEFT
|| edge == RectangleEdge.RIGHT) {
max = Math.max(max, calculateTextBlockWidth(label,
position, g2));
}
Tick tick = new CategoryTick(category, label,
position.getLabelAnchor(), position.getRotationAnchor(),
position.getAngle());
ticks.add(tick);
categoryIndex = categoryIndex + 1;
}
}
state.setMax(max);
return ticks;
}
LineChartandXYLineChartand both show numbers on theDomainAxis- GrahamA