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

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

Introduction

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

Prototype

public XYSeriesCollection() 

Source Link

Document

Constructs an empty dataset.

Usage

From source file:simcommunity.XYChart.java

private XYDataset createDataset(ArrayList<Float> dSet) {

    final XYSeries omogeneita = new XYSeries("omogeneita");
    int i;/*from w ww .  ja  v  a2 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:Servizi.GraficoJ.java

/**
 *
 * Creazione del dataset da utilizzare per la generazione del grafi
 *
 * Ogni grafico ha un suo dataset specifico
 *
 * @return un dataset di default./*from   w  ww  .j ava  2  s . c  o m*/
 *
 */
private XYDataset createDataset(Double[] datiFitness, Double fitnessLinea) {

    XYSeriesCollection dataset = new XYSeriesCollection();

    XYSeries dataLineaDef = riempiDataLineaDeformabile("Fitness Linea Deformabile", datiFitness);

    XYSeries dataLinea = riempiDataLinea("Fitness Linea", datiFitness, fitnessLinea);

    dataset.addSeries(dataLinea);
    dataset.addSeries(dataLineaDef);

    return dataset;

}

From source file:com.cs572.assignments.Project2.view.LineChartPanel.java

private XYDataset createDataset(float actualOutput[], float expectedOutput[]) {

    XYSeries series1 = new XYSeries("Actual Output");
    for (int x = 0; x < actualOutput.length; x++) {
        series1.add(x + 1, actualOutput[x]);
    }// w ww .  ja v a 2  s  .  c o  m

    XYSeries series2 = new XYSeries("Expected Output");
    for (int x = 0; x < actualOutput.length; x++) {
        series2.add(x + 1, expectedOutput[x]);
    }

    final XYSeriesCollection dataset = new XYSeriesCollection();
    dataset.addSeries(series1);
    dataset.addSeries(series2);

    return dataset;

}

From source file:phat.sensors.accelerometer.XYAccelerationsChart.java

/**
 * Creates a new graphic to plot accelerations.
 *
 * @param title  the frame title./*from  w  w w  .j a  va  2s . com*/
 */
public XYAccelerationsChart(final String windowstitle, final String chartTitle, final String domainAxisLabel,
        final String rangeAxisLabel) {

    super(windowstitle);

    //Object[][][] data = new Object[3][50][2];
    xAcceleration = new XYSeries("x acc.");
    yAcceleration = new XYSeries("y acc.");
    zAcceleration = new XYSeries("z acc.");

    dataset = new XYSeriesCollection();
    dataset.addSeries(xAcceleration);
    dataset.addSeries(yAcceleration);
    dataset.addSeries(zAcceleration);

    chart = ChartFactory.createXYLineChart(chartTitle, // chart title
            domainAxisLabel, // domain axis label
            rangeAxisLabel, // range axis label
            dataset, // data
            PlotOrientation.VERTICAL, true, // include legend
            true, false);

    plot = chart.getXYPlot();
    /*final NumberAxis domainAxis = new NumberAxis("x");
    final NumberAxis rangeAxis = new LogarithmicAxis("Log(y)");
    plot.setDomainAxis(domainAxis);
    plot.setRangeAxis(rangeAxis);*/
    chart.setBackgroundPaint(Color.white);
    plot.setOutlinePaint(Color.black);
    chartPanel = new ChartPanel(chart);
    chartPanel.setPreferredSize(new java.awt.Dimension(500, 270));
    setContentPane(chartPanel);
}

From source file:edu.wustl.cab2b.client.ui.visualization.charts.LineChart.java

@Override
protected Dataset createColumnWiseData() {

    List<String> selectedColumnNames = chartModel.getSelectedColumnsNames();
    List<String> selectedRowNames = chartModel.getSelectedRowNames();

    XYSeries xySeries = null;//from   w w w  . j  a va2  s.c  o  m
    XYSeriesCollection xySeriesCollection = new XYSeriesCollection();

    for (int i = 0; i < selectedColumnNames.size(); i++) {
        String seriesName = selectedColumnNames.get(i);
        xySeries = new XYSeries(seriesName);
        for (int j = 0; j < selectedRowNames.size(); j++) {
            Object value = chartModel.getValueAt(j, i);
            xySeries.add(convertValue(selectedRowNames.get(j)), convertValue(value));
        }
        xySeriesCollection.addSeries(xySeries);
    }
    return xySeriesCollection;
}

From source file:trabajoanalisis.grafico.java

public void graficar(JTable a) {
    XYSeries series = new XYSeries("t/n");

    // Introduccion de datos
    int i = 0;/*from  ww w .j  a v a2  s  .co m*/
    while (a.getValueAt(i, 1) != null) {
        System.out.println(a.getValueAt(i, 1).toString());
        System.out.println(i);
        series.add(Integer.parseInt(a.getValueAt(i, 0).toString()),
                Integer.parseInt(a.getValueAt(i, 1).toString()));
        System.out.println("Se ha agregado " + Integer.parseInt(a.getValueAt(i, 0).toString()) + " y "
                + a.getValueAt(i, 1).toString());
        i++;

    }
    //        series.add(1, 1);
    //        series.add(2, 6);
    //        series.add(3, 3);
    //        series.add(4, 10);

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

    JFreeChart chart = ChartFactory.createXYLineChart("Grafica", // Ttulo
            "n", // Etiqueta Coordenada X
            "tiempo", // Etiqueta Coordenada Y
            dataset, // Datos
            PlotOrientation.VERTICAL, true, // Muestra la leyenda de los productos (Producto A)
            false, false);

    // Mostramos la grafica en pantalla
    ChartFrame frame = new ChartFrame("Grafica", chart);
    frame.pack();
    frame.setVisible(true);

}

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

/**
 * Creates a new demo./*from   w  w w  .j  ava2s .c o  m*/
 *
 * @param title  the frame title.
 */
public LineChartDemo3(final String title) {

    super(title);

    // create a dataset...
    final XYSeriesCollection dataset = new XYSeriesCollection();
    for (int i = 0; i < 10; i++) {
        final XYSeries series = new XYSeries("S" + i);
        for (int j = 0; j < 10; j++) {
            series.add(j, Math.random() * 100);
        }
        dataset.addSeries(series);
    }

    final JFreeChart chart = createChart(dataset);

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

}

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);
    }//  w  w w.j av  a  2 s  .  co m
    XYSeriesCollection dataset = new XYSeriesCollection();
    dataset.addSeries(series);
    return dataset;

}

From source file:beadAnalyzer.DrawPoints.java

public XYSeries drawPoints(final ArrayList<GaussianFitParam> beadparams, final String name, final int numBins) {

    final XYSeriesCollection dataset = new XYSeriesCollection();

    XYSeries seriesname = new XYSeries(name);

    List<Double> Xvalues = new ArrayList<Double>();
    List<Double> Yvalues = new ArrayList<Double>();

    if (name == "Sigma") {

        for (final GaussianFitParam param : beadparams) {

            seriesname.add(param.Sigma[0], param.Sigma[1]);
            Xvalues.add(param.Sigma[0]);
            Yvalues.add(param.Sigma[1]);

        }/* ww  w . j a  v a2  s.  c  om*/

    }

    dataset.addSeries(seriesname);

    final JFreeChart histXchart = makehistXChart(Xvalues, numBins);
    final JFreeChart histYchart = makehistYChart(Yvalues, numBins);

    display(histXchart, new Dimension(500, 500));
    display(histYchart, new Dimension(500, 500));

    return seriesname;
}

From source file:org.encog.workbench.dialogs.training.ChartPane.java

/**
 * Construct the pane.//from  www.j  av  a  2 s.  c  o m
 */
public ChartPane() {
    this.series1 = new XYSeries("Current Error");
    this.dataset1 = new XYSeriesCollection();
    this.dataset1.addSeries(this.series1);
    this.series1.setMaximumItemCount(50);

    this.series2 = new XYSeries("Error Improvement");
    this.dataset2 = new XYSeriesCollection();
    this.dataset2.addSeries(this.series2);
    this.series2.setMaximumItemCount(50);

    // addData(1,1,0.01);

    final JFreeChart chart = createChart();
    this.chartPanel = new ChartPanel(chart);
    this.chartPanel.setPreferredSize(new java.awt.Dimension(600, 270));
    this.chartPanel.setDomainZoomable(true);
    this.chartPanel.setRangeZoomable(true);
    setLayout(new BorderLayout());
    add(this.chartPanel, BorderLayout.CENTER);

}