Search in sources :

Example 1 with OverlayFX

use of org.jfree.chart.fx.overlay.OverlayFX in project jfreechart-fx by jfree.

the class ChartCanvas method draw.

/**
 * Draws the content of the canvas and updates the
 * {@code renderingInfo} attribute with the latest rendering
 * information.
 */
public final void draw() {
    GraphicsContext ctx = getGraphicsContext2D();
    ctx.save();
    double width = getWidth();
    double height = getHeight();
    if (width > 0 && height > 0) {
        ctx.clearRect(0, 0, width, height);
        this.info = new ChartRenderingInfo();
        if (this.chart != null) {
            this.chart.draw(this.g2, new Rectangle((int) width, (int) height), this.anchor, this.info);
        }
    }
    ctx.restore();
    for (OverlayFX overlay : this.overlays) {
        overlay.paintOverlay(g2, this);
    }
    this.anchor = null;
}
Also used : OverlayFX(org.jfree.chart.fx.overlay.OverlayFX) GraphicsContext(javafx.scene.canvas.GraphicsContext) ChartRenderingInfo(org.jfree.chart.ChartRenderingInfo) Rectangle(java.awt.Rectangle)

Aggregations

Rectangle (java.awt.Rectangle)1 GraphicsContext (javafx.scene.canvas.GraphicsContext)1 ChartRenderingInfo (org.jfree.chart.ChartRenderingInfo)1 OverlayFX (org.jfree.chart.fx.overlay.OverlayFX)1