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:pi.bestdeal.models.Charts.java

public XYSeriesCollection createDataset(String DateDebut, String DateFin, int idDeal) {
    XYSeries series = new XYSeries("volution des consultations");
    ChartDAO aO = ChartDAO.getInstance();
    for (int a : aO.daysvaluesConsultation(DateDebut, DateFin, idDeal)) {

        series.add(aO.daysvaluesConsultation(DateDebut, DateFin, idDeal).indexOf(a), a);
    }/*  w w  w  . j  a v  a  2s.c o m*/
    XYSeriesCollection dataset = new XYSeriesCollection();
    dataset.addSeries(series);
    return dataset;

}

From source file:pi.bestdeal.models.Charts.java

public XYSeriesCollection createDatasetRes(String DateDebut, String DateFin, int idDeal) {
    XYSeries series = new XYSeries("volution des Reservations");
    ChartDAO aO = ChartDAO.getInstance();
    for (int a : aO.daysvaluesReservation(DateDebut, DateFin, idDeal)) {

        series.add(aO.daysvaluesReservation(DateDebut, DateFin, idDeal).indexOf(a), a);
    }/* www . j  a v a  2 s.c o m*/
    XYSeriesCollection dataset = new XYSeriesCollection();
    dataset.addSeries(series);
    return dataset;

}

From source file:simcommunity.XYChart.java

private XYDataset createDataset(ArrayList<Float> dSet) {

    final XYSeries omogeneita = new XYSeries("omogeneita");
    int i;// ww w . ja v  a 2 s .c o m

    for (i = 0; i < dSet.size(); i++)
        omogeneita.add(i, dSet.get(i));

    final XYSeriesCollection dataset = new XYSeriesCollection();
    dataset.addSeries(omogeneita);

    return dataset;

}

From source file:playground.benjamin.scenarios.zurich.analysis.charts.BkDeltaUtilsChart.java

private XYSeriesCollection createNeededDataset() {
    //instancing the dataset 
    XYSeriesCollection ds = new XYSeriesCollection();

    ds.addSeries(this.createSeries("delta utils over personal income",
            personalIncome2Scores(populationInformation)));
    return ds;/*from ww  w . ja v a2s.co m*/
}

From source file:Hyperbole.java

private XYDataset createDataset() {
    XYSeries series = new XYSeries("Points");
    this.series = series;

    // x^2/12 - y^2/3 = -1
    draw("(Math.pow(i, 2)/12) - (Math.pow(i*2, 2)/3) +1;");

    XYSeriesCollection dataset = new XYSeriesCollection();
    dataset.addSeries(series);

    return dataset;
}

From source file:org.mc.okapi.Plot.java

public Plot(double[] X, double[] Y, String xLab, String yLab, String seriesName, String applicationTitle,
        String chartTitle) {/*from  w w w .j a va 2 s .co  m*/
    super(applicationTitle);

    XYSeries series = new XYSeries(seriesName);

    for (int i = 0; i < X.length; i++) {
        series.add(X[i], Y[i]);
    }
    // create a dataset...
    XYSeriesCollection dataset = new XYSeriesCollection();
    dataset.addSeries(series);

    // based on the dataset we create the chart        
    JFreeChart chart = ChartFactory.createScatterPlot(chartTitle, xLab, yLab, dataset, PlotOrientation.VERTICAL,
            true, rootPaneCheckingEnabled, rootPaneCheckingEnabled);
    Shape cross = ShapeUtilities.createDiagonalCross(3, 1);
    XYPlot xyPlot = (XYPlot) chart.getPlot();
    xyPlot.setDomainCrosshairVisible(true);
    xyPlot.setRangeCrosshairVisible(true);
    XYItemRenderer renderer = xyPlot.getRenderer();
    renderer.setSeriesShape(0, cross);
    renderer.setSeriesPaint(0, Color.red);

    // we put the chart into a panel
    ChartPanel chartPanel = new ChartPanel(chart);
    setIconImage(Toolkit.getDefaultToolkit().getImage("images/ico/extra/science_32.png"));

    // default size
    chartPanel.setPreferredSize(new java.awt.Dimension(500, 270));
    // add it to our application
    setContentPane(chartPanel);

}

From source file:playground.dgrether.analysis.charts.DgAvgDeltaUtilsModeGroupChart.java

@Override
protected XYSeriesCollection createDatasets(String runId1, String runId2) {
    DgModeSwitchPlanTypeAnalyzer modeSwitchAnalysis = new DgModeSwitchPlanTypeAnalyzer(this.ana, runId1,
            runId2);//  w  w w.  j a v a  2s  . c  o m
    DgAnalysisPopulation car2carPop = modeSwitchAnalysis
            .getPersonsForModeSwitch(new Tuple<String, String>(TransportMode.car, TransportMode.car));
    DgAnalysisPopulation pt2ptPop = modeSwitchAnalysis
            .getPersonsForModeSwitch(new Tuple<String, String>(TransportMode.pt, TransportMode.pt));
    DgAnalysisPopulation pt2carPop = modeSwitchAnalysis
            .getPersonsForModeSwitch(new Tuple<String, String>(TransportMode.pt, TransportMode.car));
    DgAnalysisPopulation car2ptPop = modeSwitchAnalysis
            .getPersonsForModeSwitch(new Tuple<String, String>(TransportMode.car, TransportMode.pt));
    XYSeriesCollection ds = new XYSeriesCollection();
    ds.addSeries(
            this.createXYSeries("Mean " + '\u0394' + "Utility Car2Car", car2carPop, runId1, runId2).getFirst());
    ds.addSeries(
            this.createXYSeries("Mean " + '\u0394' + "Utility Pt2Pt", pt2ptPop, runId1, runId2).getFirst());
    ds.addSeries(
            this.createXYSeries("Mean " + '\u0394' + "Utility Pt2Car", pt2carPop, runId1, runId2).getFirst());
    ds.addSeries(
            this.createXYSeries("Mean " + '\u0394' + "Utility Car2Pt", car2ptPop, runId1, runId2).getFirst());
    return ds;
}

From source file:iad_2_gg.gui.ChartDialog.java

private XYDataset createDataset(List<Double> values, String name, int interval) {
    XYSeries serie = new XYSeries(name);

    int i = 1;//from  w  w  w.  j  a  v  a2s  .c  o m
    for (double v : values) {
        serie.add((i * interval), v);
        i++;
    }
    XYSeriesCollection data = new XYSeriesCollection();
    data.addSeries(serie);
    return data;
}

From source file:org.rhwlab.ace3d.SegmentationLinePlot.java

public void setTree(BHCTree tree) {
    XYSeriesCollection collect = new XYSeriesCollection();
    XYSeries series = new XYSeries("");
    collect.addSeries(series);

    TreeMap<Integer, TreeSet<NucleusLogNode>> map = tree.allTreeCuts(500);

    for (Integer i : map.keySet()) {
        TreeSet<NucleusLogNode> nodes = map.get(i);
        double lnP = nodes.first().getLogPosterior();
        series.add((double) i, Math.exp(lnP));

    }//from w w  w  .j  a  v a2  s .  c  o  m
    int t = tree.getTime();
    int nu = tree.getNu();

    JFreeChart chart = ChartFactory.createXYLineChart(
            String.format("Time=%d,nu=%d,alpha=%e", tree.getTime(), tree.getNu(), tree.getAlpha()), "Index",
            "Probability", collect, PlotOrientation.VERTICAL, false, true, true);
    XYPlot plot = (XYPlot) chart.getPlot();

    ChartPanel panel = new ChartPanel(chart);
    this.add(panel);
}

From source file:userinterface.patientRole.LineChart.java

private XYDataset createDataset() {
    XYSeriesCollection dataset = new XYSeriesCollection();
    dataset.addSeries(bR);
    dataset.addSeries(pR);/*from w  ww  .  j  av a 2 s. c  o m*/
    dataset.addSeries(bS);
    dataset.addSeries(bP);
    return dataset;
}