Example usage for org.jfree.data.xy XYSeriesCollection addSeries

List of usage examples for org.jfree.data.xy XYSeriesCollection addSeries

Introduction

In this page you can find the example usage for org.jfree.data.xy XYSeriesCollection addSeries.

Prototype

public void addSeries(XYSeries series) 

Source Link

Document

Adds a series to the collection and sends a DatasetChangeEvent to all registered listeners.

Usage

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

private static XYDataset createDataset() {
    XYSeries xyseries = new XYSeries("Series 1");
    xyseries.add(0.0D, 3D);//from  w  ww.  ja  v a2 s. c o  m
    xyseries.add(1.0D, 3D);
    xyseries.add(2D, 0.0D);
    xyseries.add(3D, 1.0D);
    XYSeries xyseries1 = new XYSeries("Series 2");
    xyseries1.add(0.0D, 1.0D);
    xyseries1.add(1.0D, 2D);
    xyseries1.add(2D, 1.0D);
    xyseries1.add(3D, 3D);
    XYSeriesCollection xyseriescollection = new XYSeriesCollection();
    xyseriescollection.addSeries(xyseries);
    xyseriescollection.addSeries(xyseries1);
    return xyseriescollection;
}

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

private static XYDataset createDataset() {
    XYSeries xyseries = new XYSeries("Series 1");
    xyseries.add(1.0D, 3D);//from   w  w w  .jav a 2  s  .  c  o m
    xyseries.add(2D, 4D);
    xyseries.add(3D, 2D);
    xyseries.add(6D, 3D);
    XYSeries xyseries1 = new XYSeries("Series 2");
    xyseries1.add(1.0D, 7D);
    xyseries1.add(2D, 6D);
    xyseries1.add(3D, 9D);
    xyseries1.add(4D, 5D);
    xyseries1.add(6D, 4D);
    XYSeriesCollection xyseriescollection = new XYSeriesCollection();
    xyseriescollection.addSeries(xyseries);
    xyseriescollection.addSeries(xyseries1);
    return xyseriescollection;
}

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

private static XYDataset createDataset() {
    XYSeries xyseries = new XYSeries("Series 1");
    xyseries.add(1.0D, 3.2999999999999998D);
    xyseries.add(2D, 4.4000000000000004D);
    xyseries.add(3D, 1.7D);//from ww  w.  ja v a  2s.  c o m
    XYSeries xyseries1 = new XYSeries("Series 2");
    xyseries1.add(1.0D, 7.2999999999999998D);
    xyseries1.add(2D, 6.7999999999999998D);
    xyseries1.add(3D, 9.5999999999999996D);
    xyseries1.add(4D, 5.5999999999999996D);
    XYSeriesCollection xyseriescollection = new XYSeriesCollection();
    xyseriescollection.addSeries(xyseries);
    xyseriescollection.addSeries(xyseries1);
    return xyseriescollection;
}

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

private static XYDataset createDataset() {
    XYSeries xyseries = new XYSeries("Series 1");
    xyseries.add(1.0D, 3.2999999999999998D);
    xyseries.add(2D, 4.4000000000000004D);
    xyseries.add(3D, 1.7D);//from w  w  w .ja v a  2 s .c om
    XYSeries xyseries1 = new XYSeries("Series 2");
    xyseries1.add(1.0D, 7.2999999999999998D);
    xyseries1.add(2D, 0.0D);
    xyseries1.add(3D, 9.5999999999999996D);
    xyseries1.add(4D, 5.5999999999999996D);
    XYSeriesCollection xyseriescollection = new XYSeriesCollection();
    xyseriescollection.addSeries(xyseries);
    xyseriescollection.addSeries(xyseries1);
    return xyseriescollection;
}

From source file:com.windows.Chart.java

public static XYDataset createDataset() {
    XYSeries xyseries1 = new XYSeries("FCFS");
    xyseries1.add(1987, 50);//w  w w  .j  a  v a  2s . co  m
    xyseries1.add(1997, 20);
    xyseries1.add(2007, 30);

    XYSeries xyseries2 = new XYSeries("Two");
    xyseries2.add(1987, 20);
    xyseries2.add(1997, 10D);
    xyseries2.add(2007, 40D);

    XYSeries xyseries3 = new XYSeries("Three");
    xyseries3.add(1987, 40);
    xyseries3.add(1997, 30.0008);
    xyseries3.add(2007, 38.24);

    XYSeriesCollection xySeriesCollection = new XYSeriesCollection();
    xySeriesCollection.addSeries(xyseries1);
    xySeriesCollection.addSeries(xyseries2);
    xySeriesCollection.addSeries(xyseries3);
    return xySeriesCollection;
}

From source file:LisajousApp.Draw.java

private static XYDataset createDataset() {

    XYSeries s1 = new XYSeries("");

    for (double t = 0; t <= 2 * Math.PI; t = t + 0.0005) {
        double x = Main.a * Math.sin(Main.n * t + Main.c);
        double y = Main.b * Math.sin(t);
        s1.add(x, y);/*from   w w w .j a v a  2  s . c o m*/
    }

    XYSeriesCollection dataset = new XYSeriesCollection();
    dataset.addSeries(s1);
    return dataset;
}

From source file:eu.cassandra.csn.gui.Charts.java

/**
 * /*w ww .j  a va2 s  . c o  m*/
 * @param title
 * @param x
 * @param y
 * @param data
 * @return
 */
public static ChartPanel createGraph(String title, String x, String y, Double[] data) {
    XYSeries series1 = new XYSeries("First");
    for (int i = 0; i < data.length; i++) {
        series1.add(i, data[i]);
    }
    final XYSeriesCollection dataset = new XYSeriesCollection();
    dataset.addSeries(series1);

    PlotOrientation orientation = PlotOrientation.VERTICAL;
    boolean show = false;
    boolean toolTips = false;
    boolean urls = false;
    JFreeChart chart = ChartFactory.createXYLineChart(title, x, y, dataset, orientation, show, toolTips, urls);
    //XYPlot plot = (XYPlot) chart.getPlot();  

    ChartPanel cp = new ChartPanel(chart);
    return cp;
}

From source file:iad_zad3.gui.Charts.java

private static XYDataset createDataset(final List<double[]> data, final List<double[]> centroids) {
    XYSeries dataSeries = new XYSeries("data");

    for (double[] v : data) {
        dataSeries.add(v[0], v[1]);//from w w  w.  j a v a2s  .  c  o m
    }

    XYSeries centroidsSeries = new XYSeries("centroids");
    for (double[] v : centroids) {
        centroidsSeries.add(v[0], v[1]);
    }

    XYSeriesCollection coll = new XYSeriesCollection();
    coll.addSeries(centroidsSeries);
    coll.addSeries(dataSeries);

    return coll;
}

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

private static XYDataset createDataset() {
    XYSeries xyseries = new XYSeries("Random 1");
    xyseries.add(new Integer(1), new Double(500.19999999999999D));
    xyseries.add(new Integer(2), new Double(694.10000000000002D));
    xyseries.add(new Integer(3), new Double(-734.39999999999998D));
    xyseries.add(new Integer(4), new Double(453.19999999999999D));
    xyseries.add(new Integer(5), new Double(500.19999999999999D));
    xyseries.add(new Integer(6), new Double(300.69999999999999D));
    xyseries.add(new Integer(7), new Double(734.39999999999998D));
    xyseries.add(new Integer(8), new Double(453.19999999999999D));
    XYSeries xyseries1 = new XYSeries("Random 2");
    xyseries1.add(new Integer(1), new Double(700.20000000000005D));
    xyseries1.add(new Integer(2), new Double(534.10000000000002D));
    xyseries1.add(new Integer(3), new Double(323.39999999999998D));
    xyseries1.add(new Integer(4), new Double(125.2D));
    xyseries1.add(new Integer(5), new Double(653.20000000000005D));
    xyseries1.add(new Integer(6), new Double(432.69999999999999D));
    xyseries1.add(new Integer(7), new Double(564.39999999999998D));
    xyseries1.add(new Integer(8), new Double(322.19999999999999D));
    XYSeriesCollection xyseriescollection = new XYSeriesCollection();
    xyseriescollection.addSeries(xyseries);
    xyseriescollection.addSeries(xyseries1);
    xyseriescollection.setIntervalWidth(0.0D);
    return xyseriescollection;
}

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

private static XYDataset createDataset(int i, double d) {
    XYSeries xyseries = new XYSeries("Series " + i);
    xyseries.add(1.0D, d);/*w  w w  . jav a2s  .c  om*/
    xyseries.add(2D, d);
    xyseries.add(3D, d);
    XYSeriesCollection xyseriescollection = new XYSeriesCollection();
    xyseriescollection.addSeries(xyseries);
    return xyseriescollection;
}