Search in sources :

Example 6 with XYAnnotation

use of org.jfree.chart.annotations.XYAnnotation in project SIMVA-SoS by SESoS.

the class XYPlot method drawAnnotations.

/**
 * Draws the annotations for the plot.
 *
 * @param g2  the graphics device.
 * @param dataArea  the data area.
 * @param info  the chart rendering info.
 */
public void drawAnnotations(Graphics2D g2, Rectangle2D dataArea, PlotRenderingInfo info) {
    Iterator iterator = this.annotations.iterator();
    while (iterator.hasNext()) {
        XYAnnotation annotation = (XYAnnotation) iterator.next();
        ValueAxis xAxis = getDomainAxis();
        ValueAxis yAxis = getRangeAxis();
        annotation.draw(g2, this, dataArea, xAxis, yAxis, 0, info);
    }
}
Also used : XYAnnotation(org.jfree.chart.annotations.XYAnnotation) ValueAxis(org.jfree.chart.axis.ValueAxis) Iterator(java.util.Iterator)

Example 7 with XYAnnotation

use of org.jfree.chart.annotations.XYAnnotation in project SIMVA-SoS by SESoS.

the class AbstractXYItemRenderer method removeAnnotations.

/**
 * Removes all annotations and sends a {@link RendererChangeEvent}
 * to all registered listeners.
 */
@Override
public void removeAnnotations() {
    for (int i = 0; i < this.foregroundAnnotations.size(); i++) {
        XYAnnotation annotation = (XYAnnotation) this.foregroundAnnotations.get(i);
        annotation.removeChangeListener(this);
    }
    for (int i = 0; i < this.backgroundAnnotations.size(); i++) {
        XYAnnotation annotation = (XYAnnotation) this.backgroundAnnotations.get(i);
        annotation.removeChangeListener(this);
    }
    this.foregroundAnnotations.clear();
    this.backgroundAnnotations.clear();
    fireChangeEvent();
}
Also used : XYAnnotation(org.jfree.chart.annotations.XYAnnotation) Paint(java.awt.Paint) GradientPaint(java.awt.GradientPaint)

Aggregations

XYAnnotation (org.jfree.chart.annotations.XYAnnotation)7 Paint (java.awt.Paint)4 Iterator (java.util.Iterator)4 GradientPaint (java.awt.GradientPaint)2 ValueAxis (org.jfree.chart.axis.ValueAxis)2 XYItemRenderer (org.jfree.chart.renderer.xy.XYItemRenderer)2 Range (org.jfree.data.Range)2 Color (java.awt.Color)1 ArrayList (java.util.ArrayList)1 Collection (java.util.Collection)1 ChartPanel (org.jfree.chart.ChartPanel)1 JFreeChart (org.jfree.chart.JFreeChart)1 LegendItemCollection (org.jfree.chart.LegendItemCollection)1 XYAnnotationBoundsInfo (org.jfree.chart.annotations.XYAnnotationBoundsInfo)1 XYTextAnnotation (org.jfree.chart.annotations.XYTextAnnotation)1 AxisCollection (org.jfree.chart.axis.AxisCollection)1 AxisSpace (org.jfree.chart.axis.AxisSpace)1 NumberAxis (org.jfree.chart.axis.NumberAxis)1 NumberTickUnit (org.jfree.chart.axis.NumberTickUnit)1 CombinedDomainXYPlot (org.jfree.chart.plot.CombinedDomainXYPlot)1