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:views.analysis.LinearRegressionDisplay.java

@Override
public void initialize() {
    JFreeChart lineChart = ChartFactory.createLineChart(this.getTitle(), "Temps", "Valeurs", createDataset(),
            PlotOrientation.VERTICAL, true, true, false);

    ChartPanel chartPanel = new ChartPanel(lineChart);
    chartPanel.setPreferredSize(new java.awt.Dimension(560, 367));
    setContentPane(chartPanel);//from  www .j  a va2s  .  c  om
}

From source file:de.rbs90.fwdisp.settingsgui.gui.tabs.statistics.OtherCityStats.java

public OtherCityStats() {
    setName("Region");

    setLayout(new BorderLayout());

    DefaultPieDataset data = new DefaultPieDataset();
    data.setValue("HOT", 110);
    data.setValue("Oberlungwitz", 60);
    data.setValue("Limbach", 80);
    data.setValue("Glauchau", 90);
    data.setValue("Meerane", 100);
    data.setValue("Lichtenstein", 90);

    JFreeChart chart = ChartFactory.createPieChart3D("Einsatztypen", data, false, false, false);

    chart.setBackgroundPaint(getBackground());

    ChartPanel panel = new ChartPanel(chart);

    panel.setPopupMenu(null);/*from  ww w  .jav a 2s  .  c om*/
    add(panel, BorderLayout.CENTER);
}

From source file:Hyperbole.java

public Hyperbole(String applicationTitle, String chartTitle) {
    super(applicationTitle);
    setSize(500, 270);//from   w w w.j a v a 2  s.c  o  m
    setVisible(true);
    setFocusable(true);
    setDefaultCloseOperation(WindowConstants.EXIT_ON_CLOSE);

    manager = new ScriptEngineManager();
    engine = manager.getEngineByName("js");

    eq = new JButton("Add equation");

    XYDataset 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(eq);
    JPanel container = new JPanel();
    container.add(panel1);
    container.add(panel2);
    getContentPane().add(container);

    eq.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent e) {
            clean();
            draw(JOptionPane.showInputDialog("New equation"));
        }
    });

    pack();
}

From source file:com.raghav.plot.XYSeriesDemo.java

/**
 * A demonstration application showing an XY series containing a null value.
 *
 * @param title  the frame title.// w  w w.  j  a v a2 s  .co m
 */
public XYSeriesDemo(final String title) {

    super(title);
    final XYSeries series = new XYSeries("Random Data");
    //    float x=1;
    //    float y=(float)((Math.sqrt(2))*x);
    //    

    for (int i = 1; i < 200000; i++) {
        double x = (((double) (i)) / 1000);
        System.out.print("x = " + x);
        double xdb = 10 * (Math.log10(x));
        System.out.print("\t 10logx=" + xdb);

        double y = Erf.erfc(Math.sqrt(x));
        System.out.print("\t y=" + y);
        System.out.println("----------------------");
        series.add(xdb, y);
    }

    final XYSeriesCollection data = new XYSeriesCollection(series);
    final JFreeChart chart = ChartFactory.createXYLineChart("XY Series Demo", "X", "Y", data,
            PlotOrientation.VERTICAL, true, true, false);

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

}

From source file:one.TimeLinePanel.java

public TimeLinePanel() {
    initComponents();//from   w ww .j av  a 2  s  .c o  m

    hm = new HashMap<>();
    tm = new TaskModel();
    hm = tm.timeLineChart(101);

    task = new String[hm.size()];
    time = new Date[hm.size()];

    dataset = createDataset();
    chart = createChart(dataset);

    // add the chart to a panel...
    chartPanel = new ChartPanel(chart);
    chartPanel.setPreferredSize(new java.awt.Dimension(500, 270));
    myInit();
    //this.add(chartPanel);
    //setContentPane(chartPanel);
}

From source file:userinterface.patientRole.LineChart.java

public LineChart(String applicationTitle, String chartTitle, XYSeries bR, XYSeries pR, XYSeries bS, XYSeries bP,
        JFrame parent) {/*  w  w w . j a v  a 2 s .  c  o  m*/
    // super(applicationTitle);
    this.bR = bR;
    this.pR = pR;
    this.bS = bS;
    this.bP = bP;
    this.parent = parent;
    dataset = createDataset();
    JFreeChart xylineChart = ChartFactory.createXYLineChart(chartTitle, "Category", "Vital Signs",
            createDataset(), PlotOrientation.VERTICAL, true, true, false);
    ChartPanel chartPanel = new ChartPanel(xylineChart);
    chartPanel.setPreferredSize(new java.awt.Dimension(560, 367));
    final XYPlot plot = xylineChart.getXYPlot();
    plot.setBackgroundPaint(Color.white);
    XYLineAndShapeRenderer renderer = new XYLineAndShapeRenderer();
    renderer.setSeriesPaint(0, Color.RED);
    renderer.setSeriesPaint(1, Color.GREEN);
    renderer.setSeriesPaint(2, Color.YELLOW);
    renderer.setSeriesPaint(3, Color.BLUE);
    renderer.setSeriesStroke(0, new BasicStroke(1.0f));
    renderer.setSeriesStroke(1, new BasicStroke(1.0f));
    renderer.setSeriesStroke(2, new BasicStroke(1.0f));
    renderer.setSeriesStroke(3, new BasicStroke(1.0f));
    plot.setRenderer(renderer);
    setContentPane(chartPanel);
    addWindowListener(new java.awt.event.WindowAdapter() {
        public void windowClosing(java.awt.event.WindowEvent evt) {
            formWindowClosing(evt);
        }
    });
}

From source file:com.stableapps.anglewraparounddemo.AngleWrapDemoMain.java

/**
 * Creates a new demo instance.//from  w ww . j a v a  2s.co m
 *
 * @param title the frame title.
 */
public AngleWrapDemoMain(final String title) {
    super(title);
    final JFreeChart chart = createChart();
    final ChartPanel chartPanel = new ChartPanel(chart);
    chartPanel.setPreferredSize(new java.awt.Dimension(1024, 768));
    setContentPane(chartPanel);
}

From source file:org.onesun.sdi.swing.app.views.dialogs.ChartDialog.java

public ChartDialog(Frame parent, JFreeChart moodChart, JFreeChart sentimentChart) {
    super(parent, true);

    this.parent = parent;

    this.setLayout(new BorderLayout(5, 5));

    setTitle("Chart");
    setSize(350, 225);//from  www  .  j  a v  a2s .  co  m
    setResizable(false);
    setVisible(false);

    JPanel chartPanel = new JPanel(new GridLayout(1, 2));

    chartPanel.add(new ChartPanel(moodChart));
    chartPanel.add(new ChartPanel(sentimentChart));

    JPanel panel = new JPanel(new FlowLayout(FlowLayout.CENTER, 5, 15));
    panel.add(okButton);

    this.add(chartPanel, BorderLayout.CENTER);
    this.add(panel, BorderLayout.SOUTH);

    UserActionListener userActionListener = new UserActionListener();
    okButton.addActionListener(userActionListener);
}

From source file:old.MonitoringChart.java

public MonitoringChart(String title) {
    setLayout(new BorderLayout());
    chart = createChart(title, createDataset());
    add(new ChartPanel(chart), BorderLayout.CENTER);

    new DataThread().start();
}

From source file:com.moczul.jbacktester.Main.java

private static void showCapitalChart(XYDataset dataset) {
    final JFreeChart chart = ChartFactory.createXYLineChart("Capital curve", // chart title
            "X", // x axis label
            "Y", // y axis label
            dataset, // data
            PlotOrientation.VERTICAL, true, // include legend
            true, // tooltips
            false // urls
    );/*  w  ww.j  ava  2  s .c  o m*/

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

    JFrame frame = new JFrame();
    frame.setContentPane(chartPanel);

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