Example usage for org.jfree.chart.plot Plot draw

List of usage examples for org.jfree.chart.plot Plot draw

Introduction

In this page you can find the example usage for org.jfree.chart.plot Plot draw.

Prototype

public abstract void draw(Graphics2D g2, Rectangle2D area, Point2D anchor, PlotState parentState,
        PlotRenderingInfo info);

Source Link

Document

Draws the plot within the specified area.

Usage

From source file:org.n52.oxf.render.sos.ScatterPlotChartRenderer.java

/**
 * The resulting IVisualization shows a scatterplot.
 * /*from w w  w  . j a  v a 2  s .c  o  m*/
 * Auf X- und Y-Achse wird jeweils eine observedProperty abgetragen.
 * 
 * Ein Punkt steht dann fr ein Wertepaar (X,Y) fr ein FOI zu einem bestimmten Zeitpunkt.
 * 
 * TODO PROBLEM: Macht nur Sinn, wenn fr jedes (FOI, Time)-Tuple jeweils ein Wert fr BEIDE
 * observedPropertys enthalten ist !!!!
 */
public IVisualization renderChart(OXFFeatureCollection observationCollection, ParameterContainer paramCon,
        int width, int height) {
    JFreeChart chart = renderChart(observationCollection, paramCon);

    Plot plot = chart.getPlot();

    // draw plot into image:

    BufferedImage image = new BufferedImage(width, height, BufferedImage.TYPE_INT_RGB);

    Graphics2D g = image.createGraphics();

    plot.draw(g, new Rectangle2D.Float(0, 0, width, height), null, null, null);

    return new StaticVisualization(image);
}

From source file:org.n52.oxf.render.sos.TimeSeriesChartRenderer.java

/**
 * The resulting IVisualization shows a chart which consists a TimeSeries for each FeatureOfInterest
 * contained in the observationCollection.
 *//* w  w  w  . j  ava  2s.co  m*/
public IVisualization renderChart(OXFFeatureCollection observationCollection, ParameterContainer paramCon,
        int width, int height) {
    JFreeChart chart = renderChart(observationCollection, paramCon);

    Plot plot = chart.getPlot();

    // draw plot into image:

    BufferedImage image = new BufferedImage(width, height, BufferedImage.TYPE_INT_RGB);

    Graphics2D g = image.createGraphics();

    g.setColor(Color.white);
    g.fillRect(0, 0, width, height);

    plot.draw(g, new Rectangle2D.Float(0, 0, width, height), null, null, null);

    return new StaticVisualization(image);
}

From source file:org.n52.oxf.render.sos.TimeSeriesChartRenderer4xPhenomenons.java

/**
 * The resulting IVisualization shows a chart which consists a TimeSeries for each FeatureOfInterest
 * contained in the observationCollection.
 *//*from  w w w  .j a va 2  s  .  c om*/
public IVisualization renderChart(OXFFeatureCollection observationCollection, ParameterContainer paramCon,
        int width, int height) {
    JFreeChart chart = renderChart(observationCollection, paramCon);

    // draw plot into image:
    Plot plot = chart.getPlot();
    BufferedImage chartImage = new BufferedImage(width, height, BufferedImage.TYPE_INT_RGB);
    Graphics2D chartGraphics = chartImage.createGraphics();
    chartGraphics.setColor(Color.white);
    chartGraphics.fillRect(0, 0, width, height);
    plot.draw(chartGraphics, new Rectangle2D.Float(0, 0, width, height), null, null, null);

    // draw legend into image:
    LegendTitle legend = chart.getLegend();
    BufferedImage legendImage = new BufferedImage(width, height, BufferedImage.TYPE_INT_RGB);
    Graphics2D legendGraphics = legendImage.createGraphics();
    legendGraphics.setColor(Color.white);
    legendGraphics.fillRect(0, 0, (int) legend.getWidth(), (int) legend.getHeight());
    legend.draw(legendGraphics, new Rectangle2D.Float(0, 0, width, height));

    return new StaticVisualization(chartImage, legendImage);
}