The labels are rotated 45 degrees as follows:
Code: Select all
NumberAxis2 rangeAxis1 = new NumberAxis2("Range 17777444444444444444444444444444444444444444444444555");
rangeAxis1.setLabelAngle(-1 * (Math.PI / 4.0));
The translation and rotation of the labels works great, but, long labels, that extend to the right past the dataRect of the right-most child plot (of the combinedDomain parent plot), get clipped .
I have tried setting the insets of the parent plot to increase real estate on right - (as necessary to allow the full label to be displayed) - but, little joy...

I am doing the inset reset on the parentPlot in the drawLabel(...) method right after the top axis label is drawn. The following snippet is what I have tried:
Code: Select all
public class NumberAxis2 extends ValueAxis implements Cloneable, Serializable {
. . .
protected AxisState drawLabel(String label,
Graphics2D g2,
Rectangle2D plotArea,
Rectangle2D dataArea,
RectangleEdge edge,
AxisState state) {
. . .
if (edge == RectangleEdge.TOP) {
// Draw the label so that is is left justified with respect to dataRect.
AffineTransform t = AffineTransform.getRotateInstance(
getLabelAngle(), labelBounds.getMinX(), labelBounds.getCenterY()
);
Shape rotatedLabelBounds = t.createTransformedShape(labelBounds);
labelBounds = rotatedLabelBounds.getBounds2D();
double labelx = dataArea.getMinX() + (labelBounds.getWidth() / 2.0);
double labely = state.getCursor() - insets.bottom - labelBounds.getHeight() / 2.0;
RefineryUtilities.drawRotatedString(
label, g2, (float) labelx, (float) labely,
TextAnchor.CENTER, TextAnchor.CENTER, getLabelAngle()
);
state.cursorUp(insets.top + labelBounds.getHeight() + insets.bottom);
// Adjust insets of parent plot to accomodate this label.
Plot parentPlot = this.getPlot().getParent();
Insets currentInsets = parentPlot.getInsets();
int newRightInset = currentInsets.right;
if (labelBounds.getWidth() > dataArea.getWidth()) {
newRightInset = (int)(labelBounds.getWidth() - dataArea.getWidth());
}
Insets newInsets = new Insets(currentInsets.bottom,
currentInsets.left,
newRightInset,
currentInsets.top);
parentPlot.setInsets(newInsets, false);
}
. . .
}
. . .
}
If I change the last line of code:
Code: Select all
parentPlot.setInsets(newInsets, false);
Code: Select all
parentPlot.setInsets(newInsets, true);
How else can I attack this problem? Please let me know what else would be helpful for me to provide.
All this said, I am new to JFreeChart - have only been using it for a month, off and on. But, I am enjoying using it immensely - it is very powerful and will be a great asset to our organization and users.
Thanks in advance for your help.
Cheers,
Wendy
Wendy Gross
NOAA Paleoclimatology Program
325 Broadway MC E/GC
Boulder, Colorado 80305
Email: wendy.gross@noaa.gov
http://www.ncdc.noaa.gov/paleo