Example usage for org.jfree.chart.annotations CategoryTextAnnotation setRotationAngle

List of usage examples for org.jfree.chart.annotations CategoryTextAnnotation setRotationAngle

Introduction

In this page you can find the example usage for org.jfree.chart.annotations CategoryTextAnnotation setRotationAngle.

Prototype

public void setRotationAngle(double angle) 

Source Link

Document

Sets the rotation angle and sends an AnnotationChangeEvent to all registered listeners.

Usage

From source file:org.operamasks.faces.render.graph.ChartRenderer.java

private CategoryTextAnnotation createCategoryTextAnnotation(UITextAnnotation at, Comparable key) {
    CategoryTextAnnotation result;

    String label = at.getText();// w ww . ja  v a2 s  . c  om
    double value = Coercion.coerceToDouble(at.getyValue());

    if (at.isDrawArrow()) {
        Double angle = at.getArrowAngle();
        if (angle == null)
            angle = 0.0;
        CategoryPointerAnnotation pointer = new CategoryPointerAnnotation(label, key, value,
                angle * Math.PI / 180.0);

        Double length = at.getArrowLength();
        if (length != null) {
            pointer.setBaseRadius(length);
        }

        Paint arrowColor = at.getArrowColor();
        if (arrowColor == null)
            arrowColor = at.getColor();
        if (arrowColor != null)
            pointer.setArrowPaint(arrowColor);

        result = pointer;
    } else {
        result = new CategoryTextAnnotation(label, key, value);
    }

    Font font = at.getFont();
    if (font != null) {
        result.setFont(font);
    }

    Paint color = at.getColor();
    if (color != null) {
        result.setPaint(color);
    }

    TextAnchor anchor = getTextAnchor(at.getAnchor());
    if (anchor != null) {
        result.setTextAnchor(anchor);
    }

    Double rotationAngle = at.getRotationAngle();
    if (rotationAngle != null) {
        result.setRotationAngle(rotationAngle * Math.PI / 180.0);
    }

    return result;
}