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:GUI.PlotHere.java

/**
 * Creates new form PlotHere/*w  ww .ja v  a  2s  .c  o  m*/
 */
public PlotHere(String Title) {
    initComponents();
    XYSeries Input00 = new XYSeries("Input 00");
    XYSeries Input01 = new XYSeries("Input 01");
    XYSeries Input02 = new XYSeries("Input 02");
    XYSeriesCollection data = new XYSeriesCollection(Input00);
    data.addSeries(Input01);
    data.addSeries(Input02);
    JFreeChart chart = ChartFactory.createXYLineChart(Title, "Angle", "Voltage", data, PlotOrientation.VERTICAL,
            true, true, false);
    ChartPanel chartpanel = new ChartPanel(chart);
    //chartpanel.setDomainZoomable(true);
    chartpanel.setPreferredSize(new java.awt.Dimension(200, 200));

    //JPanel jPanel4 = new JPanel();

    Component[] a = GraphHerePanel.getComponents();
    if (a.length == 0) {
        GraphHerePanel.setLayout(new BorderLayout());
        GraphHerePanel.add(chartpanel);
    }
    this.revalidate();
    this.repaint();

}

From source file:vista.montecarlo.GraficoEvolutivo.java

public GraficoEvolutivo(String applicationTitle, String chartTitle, double[][] costos) {
    super(applicationTitle);
    costosPromedio = costos;//from   w  ww. ja  v a 2  s  .  c om
    JFreeChart lineChart = ChartFactory.createLineChart(chartTitle, TITL_EJE_X, TITL_EJE_Y, createDataset(),
            PlotOrientation.VERTICAL, true, true, false);

    ChartPanel chartPanel = new ChartPanel(lineChart);
    chartPanel.setPreferredSize(new java.awt.Dimension(1300, 733));
    setContentPane(chartPanel);
    setDefaultCloseOperation(DISPOSE_ON_CLOSE);
}

From source file:UserInterface.FarmerRole.HumidityGraph.java

public HumidityGraph(double value, String type) {

    data = new DefaultValueDataset(value);
    final JFrame frame = new JFrame();
    meterPlot = new MeterPlot(data);
    frame.getContentPane().setLayout(new BorderLayout(5, 5));
    frame.setDefaultCloseOperation(3);//  w w w.ja  va 2  s.  c o m
    frame.setTitle("Inventory Humidity");
    meterChart = new JFreeChart("Humidity Chart", JFreeChart.DEFAULT_TITLE_FONT, this.meterPlot, false);
    panelMeter = new ChartPanel(this.meterChart);
    frame.getContentPane().add(panelMeter, BorderLayout.CENTER);
    frame.setSize(700, 400);
    final Dimension d = Toolkit.getDefaultToolkit().getScreenSize();
    frame.setLocation((d.width - frame.getSize().width) / 2, (d.height - frame.getSize().height) / 2);
    frame.setVisible(true);

}

From source file:GUILayer.CustomerStatsByGroup.java

protected void makeStatistics(String title, String chartTitle, PieDataset dataset) {
    JFreeChart chart = createChart(dataset, chartTitle);
    ChartPanel chartPanel = new ChartPanel(chart);
    chartPanel.setPreferredSize(new java.awt.Dimension(500, 300));
    setContentPane(chartPanel);//from  ww w . j ava  2 s . com
}

From source file:Diagramas.BarChart_AWT.java

public BarChart_AWT(String applicationTitle, String chartTitle) throws IOException {
    super(applicationTitle);
    JFreeChart barChart = ChartFactory.createBarChart(chartTitle, "Category", "Score", createDataset(),
            PlotOrientation.VERTICAL, true, true, false);

    int width = 640; /* Width of the image */
    int height = 480; /* Height of the image */
    File BarChart = new File("BarChart.png");
    ChartUtilities.saveChartAsPNG(BarChart, barChart, width, height);

    ChartPanel chartPanel = new ChartPanel(barChart);
    chartPanel.setPreferredSize(new java.awt.Dimension(560, 367));
    setContentPane(chartPanel);/*from   w w  w .  jav a  2s  . c o m*/
}

From source file:com.mergano.core.AreaChart.java

public ChartPanel getChart() {
    // create a dataset...
    final double[][] data = new double[][] {
            { 34.0, 10.0, 2.0, 25.0, 53.0, 79.0, 27.0, 13.0, 34.0, 13.0, 5.0, 39.0, 69.0, 85.0, 55.0, 32.0,
                    48.0, 25.0, 53.0, 79.0, 27.0, 13.0, 34.0, 13.0, 0, 79.0, 27.0, 13.0, 34.0, 13.0, } };

    final CategoryDataset dataset = DatasetUtilities.createCategoryDataset("May ", "Day ", data);
    // create the chart...
    final JFreeChart chart = createChart(dataset);
    chartPanel = new ChartPanel(chart);

    return chartPanel;
}

From source file:org.eclipse.mylyn.tests.chart.ChartTest.java

public ChartTest(final String title) {
    final CategoryDataset dataset = createCategoryDataset();
    final JFreeChart chart = createChart(dataset);
    final ChartPanel chartPanel = new ChartPanel(chart);
    chartPanel.setPreferredSize(new java.awt.Dimension(500, 270));
    super.setContentPane(chartPanel);
}

From source file:Visao.Relatorio.Grafico_QuantidadeReclamacoesSexo.java

private void grafico(JFreeChart chart) {

    ChartPanel panel = new ChartPanel(chart);
    panel.setPreferredSize(new Dimension(600, 600));
    setContentPane(panel);/*from  w  w  w .  j ava2 s  .  c  o m*/
    this.pack();
}

From source file:scatterplot1k.JFreeScatter2.java

public JFreeScatter2(String title, int samplesCount) {
    super(title);
    this.samplesCount = samplesCount;
    JFreeChart chart = createChart(title, createDataset());
    ChartPanel panel = new ChartPanel(chart);
    panel.setPreferredSize(new Dimension(800, 600));
    panel.setMouseZoomable(false);/*from  w w w  .  ja v  a  2 s .  c  om*/
    this.add(panel);
}

From source file:LineChart.java

public LineChart(JTable table) {
    final JFrame frame = new JFrame("jshow Chart");

    final JFreeChart chart = createDataset(table);
    final ChartPanel chartPanel = new ChartPanel(chart);
    chartPanel.setPreferredSize(new java.awt.Dimension(500, 270));
    chartPanel.setMouseZoomable(true, false);
    frame.setContentPane(chartPanel);//w w w  . j  a v a2 s  .c o m

    frame.setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE);

    frame.setIconImage(Toolkit.getDefaultToolkit()
            .createImage(LineChart.class.getResource("de/skelton/images/chart.png")));

    frame.pack();
    frame.setVisible(true);
    frame.requestFocus();
    frame.toFront();
}