Rectangle2D labelBounds = TextUtilities.getTextBounds( tick.getText(), g2, fm); if (labelBounds.getWidth() + insets.getTop() + insets.getBottom() > maxHeight) { maxHeight = labelBounds.getWidth() + insets.getTop() + insets.getBottom(); g2.getFontRenderContext()); maxHeight = metrics.getHeight() + insets.getTop() + insets.getBottom();
/** * Estimates the maximum tick label height. * * @param g2 the graphics device. * * @return The maximum height. */ protected double estimateMaximumTickLabelHeight(Graphics2D g2) { RectangleInsets tickLabelInsets = getTickLabelInsets(); double result = tickLabelInsets.getTop() + tickLabelInsets.getBottom(); Font tickLabelFont = getTickLabelFont(); FontRenderContext frc = g2.getFontRenderContext(); result += tickLabelFont.getLineMetrics("123", frc).getHeight(); return result; }
/** * Estimates the maximum tick label height. * * @param g2 the graphics device. * * @return The maximum height. * * @since 1.0.7 */ protected double estimateMaximumTickLabelHeight(Graphics2D g2) { RectangleInsets tickLabelInsets = getTickLabelInsets(); double result = tickLabelInsets.getTop() + tickLabelInsets.getBottom(); Font tickLabelFont = getTickLabelFont(); FontRenderContext frc = g2.getFontRenderContext(); result += tickLabelFont.getLineMetrics("123", frc).getHeight(); return result; }
/** * A utility method for determining the height of a text block. * * @param block the text block. * @param position the label position. * @param g2 the graphics device. * * @return The height. */ protected double calculateTextBlockHeight(TextBlock block, CategoryLabelPosition position, Graphics2D g2) { RectangleInsets insets = getTickLabelInsets(); Size2D size = block.calculateDimensions(g2); Rectangle2D box = new Rectangle2D.Double(0.0, 0.0, size.getWidth(), size.getHeight()); Shape rotatedBox = ShapeUtilities.rotateShape(box, position.getAngle(), 0.0f, 0.0f); double h = rotatedBox.getBounds2D().getHeight() + insets.getTop() + insets.getBottom(); return h; }
g2.getFontRenderContext()); maxWidth = metrics.getHeight() + insets.getTop() + insets.getBottom();
double result = tickLabelInsets.getTop() + tickLabelInsets.getBottom();
(float) labely, TextAnchor.CENTER, getLabelAngle(), TextAnchor.CENTER); state.cursorUp(insets.getTop() + labelBounds.getHeight() + insets.getBottom()); double labelx = dataArea.getCenterX(); double labely = state.getCursor() + insets.getTop() + labelBounds.getHeight() / 2.0; TextUtilities.drawRotatedString(label, g2, (float) labelx, (float) labely, TextAnchor.CENTER, getLabelAngle(), TextAnchor.CENTER); state.cursorDown(insets.getTop() + labelBounds.getHeight() + insets.getBottom());
max = Math.max(max, rotatedBox.getBounds2D().getWidth() + insets.getTop() + insets.getBottom());
result[1] = (float) (cursor + insets.getTop() + 2.0);