Example usage for org.jfree.chart ChartPanel ChartPanel

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

Introduction

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

Prototype

public ChartPanel(JFreeChart chart) 

Source Link

Document

Constructs a panel that displays the specified chart.

Usage

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   ww  w .jav 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:Operacional.Janela2.java

public Janela2() {
    super();// w w  w .  j ava2s  .c o  m
    IntervalXYDataset intervalxydataset = createDataset();
    jfreechart = createChart(intervalxydataset);
    chartpanel = new ChartPanel(jfreechart);
    chartpanel.setPreferredSize(new Dimension(500, 300));
    setLayout(new BorderLayout());
    add(chartpanel, BorderLayout.NORTH);
}

From source file:audio.cords.old.RegressionDemo.java

public RegressionDemo(XYSeriesCollection data) {
    super("Regression Demo");
    setContentPane(new ChartPanel(createChart(data)));
    pack();
}

From source file:BrowserAverage.java

public BrowserAverage(String applicationTitle, String chartTitle) {
    super(applicationTitle);
    setSize(500, 270);//www.j a v  a 2s.  co m
    setVisible(true);
    setFocusable(true);
    setDefaultCloseOperation(WindowConstants.EXIT_ON_CLOSE);

    moarspeed = new JButton("MOAR");

    PieDataset dataset = createDataset();
    JFreeChart chart = createChart(dataset, chartTitle);
    ChartPanel chartPanel = new ChartPanel(chart);

    JPanel panel1 = new JPanel();
    panel1.add(chartPanel);
    JPanel panel2 = new JPanel();
    panel2.add(moarspeed);
    JPanel container = new JPanel();
    container.add(panel1);
    container.add(panel2);
    getContentPane().add(container);

    moarspeed.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent e) {
            rotator.setSpeed(rotator.getSpeed() + 1);
        }
    });

    pack();
}

From source file:GUI.FixingStats.java

/**
 * Creates new form InterfaceEtatDesVehiculesDansUneAnne
 *///from ww  w  . jav  a  2s.  c om
public FixingStats() {
    initComponents();

    CarDAO carDao = new CarDAO();

    DefaultPieDataset chartData = new DefaultPieDataset();
    for (Car car : carDao.findAllCars()) {

        chartData.setValue(car.getImmatriculation(), car.getFixing().size());

    }

    // This will create the dataset 
    PieDataset dataset = (PieDataset) chartData;

    // based on the dataset we create the chart
    JFreeChart chart = createChart(dataset, "Cars stats");
    // we put the chart into a panel
    ChartPanel chartPanel = new ChartPanel(chart);
    // default size
    chartPanel.setPreferredSize(new java.awt.Dimension(500, 270));
    // add it to our application
    setContentPane(chartPanel);
}

From source file:de.hs.mannheim.modUro.reader.JCellcycletimeDiagram.java

public JCellcycletimeDiagram(List<String> cellTypes, List<CellCycletimeEntry> cycletimesList) {
    XYDataset dataset = createDataset(cellTypes, cycletimesList);
    chart = createChart(dataset, cellTypes);
    add(new ChartPanel(chart));
}

From source file:fitmon.Chart.java

/**
 * Creates a new demo instance.//from  ww w. j a  v a2  s.  co m
 *
 * @param title  the frame title.
 */
public Chart(final String title) {

    super(title);

    final CategoryDataset dataset = createDataset();
    final JFreeChart chart = createChart(dataset);
    final ChartPanel chartPanel = new ChartPanel(chart);
    chartPanel.setPreferredSize(new Dimension(500, 270));
    setContentPane(chartPanel);

}

From source file:audio.cords.SimplestChart.java

public SimplestChart(XYSeriesCollection data) {
    super("Regression Demo");
    setContentPane(new ChartPanel(createChart(data)));
    pack();
}

From source file:com.orange.atk.atkUI.coregui.StatisticDialog.java

/**
 * Creates the dialog.// w w  w .j a v  a 2 s . com
 * @param campaign
 */
public StatisticDialog(Campaign campaign) {
    super(CoreGUIPlugin.mainFrame, true);
    StatisticTool statisticTool = new StatisticTool(campaign);
    ChartPanel chartpanel = new ChartPanel(statisticTool.getJfreechart());
    chartpanel.setPreferredSize(new Dimension(550, 270));
    getContentPane().add(chartpanel);
    setLocationRelativeTo(CoreGUIPlugin.mainFrame);
    this.setTitle("Statistics");
    this.pack();

    int dec_x = (CoreGUIPlugin.mainFrame.getWidth() - this.getWidth()) / 2;
    int dec_y = (CoreGUIPlugin.mainFrame.getHeight() - this.getHeight()) / 2;
    this.setLocation(CoreGUIPlugin.mainFrame.getLocationX() + dec_x,
            CoreGUIPlugin.mainFrame.getLocationY() + dec_y);

    this.setVisible(true);
}

From source file:ch.zhaw.parallelComputing.view.Plotter.java

/**
 * Displays a plot of the given data sets as a dialog with a save as PNG option
 * @param parent component to set the dialog relative to
 * @param title the name of the Plot and the header of the dialog
 * @param dataset1 the first data set for plotting
 * @param dataset2 the second data set for plotting
 */// w  w  w  . ja va 2 s .  c o m
public static void plotWithDialog(Component parent, String title, XYDataset dataset1, XYDataset dataset2) {
    JFreeChart chart = plot(title, dataset1, dataset2);

    ChartPanel chartPanel = new ChartPanel(chart);
    chartPanel.setPreferredSize(new java.awt.Dimension(1024, 768));
    chartPanel.setMouseZoomable(true, false);

    String[] options = { "Print", "OK" };
    int response = JOptionPane.showOptionDialog(parent // Center in window.
            , chartPanel, title // Title in titlebar
            , JOptionPane.YES_NO_OPTION // Option type
            , JOptionPane.PLAIN_MESSAGE // messageType
            , null // Icon (none)
            , options // Button text as above.
            , "OK" // Default button
    );

    if (response == 0) {
        getPlotAsPNG(title, dataset1, dataset2);
    }
}