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:osh.comdriver.simulation.cruisecontrol.AbstractDrawer.java

private XYDataset createDataset() {
    XYSeriesCollection dataset = new XYSeriesCollection();

    for (XYSeries s : getSeries(getRangeBegin(getNumberOfEntries()), getRangeEnd(getNumberOfEntries()))) {
        dataset.addSeries(s);
    }/* www.  j  ava 2  s.  c om*/

    return dataset;
}

From source file:statistics.distribution.CustomDistribution.java

private XYDataset getDataset() {
    XYSeriesCollection dataSet = new XYSeriesCollection();
    XYSeries xySeries = new XYSeries("PDF");
    double x = 1;
    for (int i = 0; i < lines.size(); i++) {
        int y = Integer.parseInt(lines.get(i).trim());
        x += y;/*from w w w  .ja v  a2s .c  o m*/
        xySeries.add(x, y);
    }
    dataSet.addSeries(xySeries);
    return dataSet;
}

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

protected XYSeriesCollection createDatasets(String runId1, String runId2) {
    XYSeriesCollection ds = new XYSeriesCollection();
    Tuple<XYSeries, List<String>> seriesLabels = this.createXYSeries("Mean " + '\u0394' + "Utility", this.ana,
            runId1, runId2);//w ww . j a  va2  s  .  c o m
    ds.addSeries(seriesLabels.getFirst());
    this.labelGenerator.setLabels(0, seriesLabels.getSecond());
    return ds;
}

From source file:playground.artemc.socialCost.MeanTravelTimeWriter.java

/**
 * @return a graphic showing the number of agents in the evacuated area
 *//*  w  ww  .  j a v  a  2  s  . c o  m*/
private JFreeChart getGraphic(String modeName, double data[]) {

    final XYSeriesCollection xyData = new XYSeriesCollection();
    final XYSeries dataSerie = new XYSeries("mean trip travel time", false, true);

    for (int i = 0; i < data.length; i++) {
        dataSerie.add(i, data[i]);
    }

    xyData.addSeries(dataSerie);

    //      final JFreeChart chart = ChartFactory.createXYStepChart(
    final JFreeChart chart = ChartFactory.createXYLineChart("mean travel time, " + modeName, "iteration",
            "travel time", xyData, PlotOrientation.VERTICAL, true, // legend
            false, // tooltips
            false // urls
    );

    XYPlot plot = chart.getXYPlot();

    final CategoryAxis axis1 = new CategoryAxis("hour");
    axis1.setTickLabelFont(new Font("SansSerif", Font.PLAIN, 7));
    plot.setDomainAxis(new NumberAxis("time"));
    return chart;
}

From source file:experiments.SimpleExample.java

public JFreeChart createChart() {
    XYSeries xyseries = new XYSeries("Fitness Line");
    xyseries.add(0.0D, 0.0D);/*  www.j a v  a  2s. com*/
    for (int i = 1; i <= fitlist.size(); i++) {
        xyseries.add(i, fitlist.get(i - 1));
    }
    XYSeriesCollection xyseriescollection = new XYSeriesCollection(); //?XYSeriesCollectionXYSeries  
    xyseriescollection.addSeries(xyseries);
    //?  
    JFreeChart jfreechart = ChartFactory.createXYLineChart("Line Chart Demo", //      
            "Iteration", // categoryAxisLabel categoryX     
            "FitnessValue", // valueAxisLabelvalueY     
            xyseriescollection, // dataset     
            PlotOrientation.VERTICAL, true, // legend     
            false, // tooltips     
            false); // URLs     

    // CategoryPlot?????     
    XYPlot plot = jfreechart.getXYPlot();
    // ? ?     
    plot.setBackgroundAlpha(0.5f);
    plot.setForegroundAlpha(0.5f);
    //        XYPlot xyplot = jfreechart.getXYPlot();  
    //??  
    ValueAxis xx = plot.getDomainAxis();
    //??  
    xx.setAutoRange(true);
    //        xx.setRange(0.0, 2000);

    ValueAxis yy = plot.getRangeAxis();
    yy.setRange(600.0, 1000);

    return jfreechart;
}

From source file:eu.choreos.chart.XYChart.java

private void createDataset(XYSeriesCollection dataset, ScalabilityReport report) {
    XYSeries series = new XYSeries(report.getName());
    double[] values = report.getSeries();
    for (int i = 1; i < values.length; i++) {
        series.add((double) i, values[i]);
    }/*from  ww  w.j  a  v a2s. c  om*/
    dataset.addSeries(series);
}

From source file:org.gephi.statistics.plugin.EigenvectorCentrality.java

/** 
 * //from   w  w  w.  j a va2 s .c o m
 * @return 
 */
@Override
public String getReport() {
    //distribution of values 
    Map<Double, Integer> dist = new HashMap<Double, Integer>();
    for (int i = 0; i < centralities.length; i++) {
        Double d = centralities[i];
        if (dist.containsKey(d)) {
            Integer v = dist.get(d);
            dist.put(d, v + 1);
        } else {
            dist.put(d, 1);
        }
    }

    //Distribution series 
    XYSeries dSeries = ChartUtils.createXYSeries(dist, "Eigenvector Centralities");

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

    JFreeChart chart = ChartFactory.createScatterPlot("Eigenvector Centrality Distribution", "Score", "Count",
            dataset, PlotOrientation.VERTICAL, true, false, false);
    chart.removeLegend();
    ChartUtils.decorateChart(chart);
    ChartUtils.scaleChart(chart, dSeries, true);
    String imageFile = ChartUtils.renderChart(chart, "eigenvector-centralities.png");

    String report = "<HTML> <BODY> <h1>Eigenvector Centrality Report</h1> " + "<hr>" + "<h2> Parameters: </h2>"
            + "Network Interpretation:  " + (isDirected ? "directed" : "undirected") + "<br>"
            + "Number of iterations: " + numRuns + "<br>" + "Sum change: " + sumChange
            + "<br> <h2> Results: </h2>" + imageFile + "</BODY></HTML>";

    return report;

}

From source file:econtroller.modeler.Modeler.java

private XYDataset getDataset(XYSeries series) {
    XYSeriesCollection dataSet = new XYSeriesCollection();
    dataSet.addSeries(series);
    return dataSet;
}

From source file:edu.ucla.stat.SOCR.chart.demo.LineChartDemo3.java

/**
 * creaets XYDataset/*from   ww w.j a  v a 2  s .c  o  m*/
 *  @param isDemo true use the demo data, false use data from the JTable
 *  @return XYDataset
 */
protected XYDataset createDataset(boolean isDemo) {
    if (isDemo) {
        XYSeriesCollection dataset = new XYSeriesCollection();
        for (int i = 0; i < 4; i++) {
            XYSeries series = new XYSeries("S" + i);
            for (int j = 0; j < 4; j++) {
                series.add(j, Math.random() * 100);
            }
            dataset.addSeries(series);
        }
        return dataset;
    } else
        return super.createDataset(false);
}

From source file:erigo.filewatch.DisplayPlot.java

/**
 * Add all the data to a new XYDataset/*from www  .  j a  v a  2  s . co m*/
 */
private XYDataset createDataset() {

    XYSeriesCollection dataset = new XYSeriesCollection();

    XYSeries series = new XYSeries("data");
    for (int i = 0; i < xData.size(); ++i) {
        series.add(xData.get(i).doubleValue(), yData.get(i).doubleValue());
    }

    //Add series to dataset
    dataset.addSeries(series);

    return dataset;

}