Example usage for org.jfree.chart ChartPanel setPreferredSize

List of usage examples for org.jfree.chart ChartPanel setPreferredSize

Introduction

In this page you can find the example usage for org.jfree.chart ChartPanel setPreferredSize.

Prototype

@BeanProperty(preferred = true, description = "The preferred size of the component.")
public void setPreferredSize(Dimension preferredSize) 

Source Link

Document

Sets the preferred size of this component.

Usage

From source file:GUI_Internalframes.StatistikAnzeige.java

/**
 * Setzt das Chart./*from   w w w . j a va  2  s.c o m*/
 * @param chart JFreechart
 */
public void setzeChart(JFreeChart chart) {
    ChartPanel chartPanel = new ChartPanel(chart);
    // default size
    chartPanel.setPreferredSize(new java.awt.Dimension(400, 270));
    // add it to our application
    setContentPane(chartPanel);
    this.setVisible(true);
}

From source file:org.jfree.chart.demo.TimeSeriesDemo2.java

/**
 * A demonstration application showing a quarterly time series containing a null value.
 *
 * @param title  the frame title./*from  ww  w  .  j  a v  a  2  s. c om*/
 */
public TimeSeriesDemo2(final String title) {

    super(title);

    final TimeSeries series = new TimeSeries("Quarterly Data", Quarter.class);
    series.add(new Quarter(1, 2001), 500.2);
    series.add(new Quarter(2, 2001), 694.1);
    series.add(new Quarter(3, 2001), 734.4);
    series.add(new Quarter(4, 2001), 453.2);
    series.add(new Quarter(1, 2002), 500.2);
    series.add(new Quarter(2, 2002), null);
    series.add(new Quarter(3, 2002), 734.4);
    series.add(new Quarter(4, 2002), 453.2);
    final TimeSeriesCollection dataset = new TimeSeriesCollection(series);
    final JFreeChart chart = ChartFactory.createTimeSeriesChart("Time Series Demo 2", "Time", "Value", dataset,
            true, true, false);
    chart.getXYPlot().addRangeMarker(new ValueMarker(550.0));
    final Quarter q = new Quarter(2, 2002);
    chart.getXYPlot().addDomainMarker(new ValueMarker(q.getMiddleMillisecond()));
    final ChartPanel chartPanel = new ChartPanel(chart);
    chartPanel.setPreferredSize(new java.awt.Dimension(500, 270));
    setContentPane(chartPanel);

}

From source file:org.jfree.chart.demo.BubblePlotDemo.java

/**
 * A demonstration application showing a bubble chart.
 *
 * @param title  the frame title./*from  w w  w. j a  v  a 2 s .  c om*/
 */
public BubblePlotDemo(final String title) {

    super(title);
    final XYZDataset data = new SampleXYZDataset();
    final JFreeChart chart = createChart(data);

    final ChartPanel chartPanel = new ChartPanel(chart);
    chartPanel.setPreferredSize(new java.awt.Dimension(500, 270));
    //   chartPanel.setVerticalZoom(true);
    // chartPanel.setHorizontalZoom(true);
    setContentPane(chartPanel);

}

From source file:org.jfree.chart.demo.CompareToPreviousYearDemo.java

public CompareToPreviousYearDemo(String s) {
    super(s);/*www  .  ja v  a 2 s .  c  o m*/
    ChartPanel chartpanel = (ChartPanel) createDemoPanel();
    chartpanel.setPreferredSize(new Dimension(500, 270));
    chartpanel.setMouseZoomable(true, true);
    setContentPane(chartpanel);
}

From source file:xdevs.lib.util.ScopeMultiView.java

public ScopeMultiView(String windowsTitle, String title, String xTitle, String yTitle) {
    super(windowsTitle);
    JFreeChart chart = ChartFactory.createXYStepChart(title, xTitle, yTitle, dataSet, PlotOrientation.VERTICAL,
            true, false, false);/*from  w w w.jav  a  2s .  co m*/
    chart.getXYPlot().setDomainAxis(new NumberAxis());
    ChartPanel chartPanel = new ChartPanel(chart);
    chartPanel.setPreferredSize(new java.awt.Dimension(500, 270));
    chartPanel.setMouseZoomable(true, false);
    setContentPane(chartPanel);
    addWindowListener(new WindowAdapter() {
        @Override
        public void windowClosing(WindowEvent e) {
            dispose();
        }
    });
    super.pack();
    RefineryUtilities.centerFrameOnScreen(this);
    this.setVisible(true);
}

From source file:org.jfree.chart.demo.SymbolicChartDemo1.java

/**
 * A demonstration application./*from   ww  w .  ja  v  a2 s  .c om*/
 * 
 * @param title
 *           the frame title.
 */
public SymbolicChartDemo1(final String title) {

    super(title);

    // create a title...
    final XYDataset dataset = createDataset();

    final ValueAxis domainAxis = new NumberAxis("X");
    final SymbolicAxis symbolicAxis = new SymbolicAxis("Y", ((YisSymbolic) dataset).getYSymbolicValues());

    final XYPlot plot = new XYPlot(dataset, domainAxis, symbolicAxis, null);
    final XYItemRenderer renderer = new StandardXYItemRenderer(StandardXYItemRenderer.SHAPES,
            new SymbolicXYItemLabelGenerator());
    plot.setRenderer(renderer);
    final JFreeChart chart = new JFreeChart(title, plot);

    final ChartPanel chartPanel = new ChartPanel(chart);
    chartPanel.setPreferredSize(new java.awt.Dimension(500, 270));
    setContentPane(chartPanel);

}

From source file:org.jfree.chart.demo.XYTitleAnnotationDemo1.java

public XYTitleAnnotationDemo1(String s) {
    super(s);/*from w  w  w.j ava 2  s . c  o m*/
    ChartPanel chartpanel = (ChartPanel) createDemoPanel();
    chartpanel.setPreferredSize(new Dimension(500, 270));
    chartpanel.setMouseZoomable(true, false);
    setContentPane(chartpanel);
}

From source file:overTrial.CreateGraphOverTrial.java

public CreateGraphOverTrial(String applicationTitle, String chartTitle, LinkedList<LinkedList<String>> pData,
        int sensorNum, String sessionNo) {
    super(applicationTitle);
    this.pressureData = pData;
    this.sensorNumber = sensorNum;
    JFreeChart lineChart = ChartFactory.createLineChart(chartTitle, sessionNo,
            "Average Pressure Value over the time(per trail)", createDataset(), PlotOrientation.VERTICAL, true,
            true, false);/*w  w w .  ja  va2s . co  m*/
    //lineChart.setBackgroundPaint(Color.red);
    ChartPanel chartPanel = new ChartPanel(lineChart);
    chartPanel.setPreferredSize(new java.awt.Dimension(1200, 500));
    setContentPane(chartPanel);

    File fileLineChart = new File(sessionNo + "_sensor" + this.sensorNumber + ".jpeg");
    try {
        ChartUtilities.saveChartAsJPEG(fileLineChart, lineChart, 1200, 500);
    } catch (IOException e) {
        e.printStackTrace();
    }

}

From source file:overTrialFluctuations.CreateGraphTrialFluctuations.java

public CreateGraphTrialFluctuations(String applicationTitle, String chartTitle,
        LinkedList<LinkedList<String>> pData, int sensorNum, String sessionNo) {
    super(applicationTitle);
    this.pressureData = pData;
    this.sensorNumber = sensorNum;
    JFreeChart lineChart = ChartFactory.createLineChart(chartTitle, sessionNo,
            "Average Pressure Value over the time(per trail)", createDataset(), PlotOrientation.VERTICAL, true,
            true, false);//from   w  ww.j  a v  a 2  s . co  m
    //lineChart.setBackgroundPaint(Color.red);
    ChartPanel chartPanel = new ChartPanel(lineChart);
    chartPanel.setPreferredSize(new java.awt.Dimension(700, 500));
    setContentPane(chartPanel);

    File fileLineChart = new File(sessionNo + "_sensor" + this.sensorNumber + ".jpeg");
    try {
        ChartUtilities.saveChartAsJPEG(fileLineChart, lineChart, 1100, 500);
    } catch (IOException e) {
        e.printStackTrace();
    }

}

From source file:overTrialSensorSubDivided.CreateGraphSubDivided.java

public CreateGraphSubDivided(String applicationTitle, String chartTitle, LinkedList<LinkedList<String>> pData,
        int sensorNum, String sessionNo) {
    super(applicationTitle);
    this.pressureData = pData;
    this.sensorNumber = sensorNum;
    JFreeChart lineChart = ChartFactory.createLineChart(chartTitle, sessionNo,
            "Average Pressure Value over the time(per trail)", createDataset(), PlotOrientation.VERTICAL, true,
            true, false);//from  w  ww  .j ava 2 s  .  c  o  m
    //lineChart.setBackgroundPaint(Color.red);
    ChartPanel chartPanel = new ChartPanel(lineChart);
    chartPanel.setPreferredSize(new java.awt.Dimension(700, 500));
    setContentPane(chartPanel);

    File fileLineChart = new File(sessionNo + "_sensor" + this.sensorNumber + ".jpeg");
    try {
        ChartUtilities.saveChartAsJPEG(fileLineChart, lineChart, 1100, 500);
    } catch (IOException e) {
        e.printStackTrace();
    }

}