Example usage for org.jfree.chart ChartFrame setSize

List of usage examples for org.jfree.chart ChartFrame setSize

Introduction

In this page you can find the example usage for org.jfree.chart ChartFrame setSize.

Prototype

public void setSize(Dimension d) 

Source Link

Document

The d.width and d.height values are automatically enlarged if either is less than the minimum size as specified by previous call to setMinimumSize .

Usage

From source file:spectrex.Charts.java

/**
 * @param data initial data for chart creation
 * @param title text which would be displayed at the top of the frame and in
 * the frame's title//from   w ww . j  a va 2s .  c  o m
 * @param columnLabel text which would be displayed on the left of the
 * Y-axis
 * @param rowLabel text which would be displayed under X-axis
 * @param frameSize size of chart frame
 * @return Bar chart JFrame link
 * @author ReaLgressA
 */
public static JFrame createBarChart(ChartData data, String title, String columnLabel, String rowLabel,
        Dimension frameSize) {
    JFreeChart chart = ChartFactory.createStackedBarChart(title, columnLabel, rowLabel, data.getDataset(),
            PlotOrientation.VERTICAL, true, true, true);
    CategoryPlot plot = chart.getCategoryPlot();
    plot.setRangeGridlinePaint(Color.BLACK);
    ChartFrame frame = new ChartFrame(title, chart, true);
    frame.setVisible(true);
    frame.setSize(frameSize);
    frame.setResizable(true);
    return (JFrame) frame;
}