Example usage for org.jfree.chart.annotations CategoryPointerAnnotation setArrowPaint

List of usage examples for org.jfree.chart.annotations CategoryPointerAnnotation setArrowPaint

Introduction

In this page you can find the example usage for org.jfree.chart.annotations CategoryPointerAnnotation setArrowPaint.

Prototype

public void setArrowPaint(Paint paint) 

Source Link

Document

Sets the paint used for the arrow 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;//  w ww .j  a va2s  .  co m

    String label = at.getText();
    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;
}