skip category labels & vertical labels

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

skip category labels & vertical labels

Post by Rich Unger » Thu Sep 19, 2002 6:41 pm

I'm graphing a verticalBar3d and can't get the setSkipCategoryLabelsToFit property to do anything.

CategoryPlot plot = (CategoryPlot)((JFreeChart)chart).getPlot();
HorizontalCategoryAxis axis = (HorizontalCategoryAxis)plot.getDomainAxis();
axis.setVerticalCategoryLabels( true );
axis.setSkipCategoryLabelsToFit( true );

I get vertical labels, but no skipping.

It works if I don't have vertical category labels set.

David Gilbert

Re: skip category labels & vertical labels

Post by David Gilbert » Fri Sep 20, 2002 11:23 am

Looking through the code, it seems that the skipping feature is only implemented for horizontal labels, not vertical ones. It is probably not a big job to extend it to work for vertical labels...

Regards,

DG.

Rich Unger

Re: skip category labels & vertical labels

Post by Rich Unger » Fri Sep 20, 2002 9:15 pm

Is that some kind of hint? :-)

All right, here's a diff on HorizontalCategoryAxis, patched against 0.9.3 sources:

328a329,333
>
> if (this.skipCategoryLabelsToFit) {
> categorySkip = (int)
> ((labelBounds.getHeight() - maxWidth/2)/maxWidth)+1;
> }

Cheers,
Rich

Locked