Example usage for org.jfree.chart.title LegendTitle getHeight

List of usage examples for org.jfree.chart.title LegendTitle getHeight

Introduction

In this page you can find the example usage for org.jfree.chart.title LegendTitle getHeight.

Prototype

public double getHeight() 

Source Link

Document

Returns the natural height of the block, if this is known in advance.

Usage

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.
 *//*w  w w .j  a v a  2  s.co m*/
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);
}