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:celeste.Celeste.java

public void pintarTrayectoriaPlaneta(int n_plat) {
    XYSeriesCollection coleccion = new XYSeriesCollection();

    String name = planetas.get(n_plat)[0];
    double a = Double.parseDouble(planetas.get(n_plat)[1]);
    double epsilon = Double.parseDouble(planetas.get(n_plat)[2]);
    double p = Double.parseDouble(planetas.get(n_plat)[3]);
    Planeta planeta = new Planeta(a, epsilon, p);

    XYSeries serie = planeta.generarPosiciones();
    serie.setKey(name);/*from   w ww  .j  a  v  a 2s . c  om*/
    coleccion.addSeries(serie);

    generarGrafica(coleccion, false);
}

From source file:edu.pdi2.visual.ViewSignature.java

public ViewSignature(String name, byte[] sign) {
    super();/*from   w ww.  j  ava  2 s  .  c o  m*/
    XYSeries signature = new XYSeries("Signature");
    for (int i = 0; i < sign.length; i++) {
        signature.add(i, sign[i]);
    }

    JFrame frame = new JFrame();
    XYSeriesCollection dataset = new XYSeriesCollection();
    dataset.addSeries(signature);
    JFreeChart signatureG = ChartFactory.createXYLineChart("Signature " + name, "Valorx", "Valory", dataset,
            PlotOrientation.VERTICAL, true, true, false);
    ChartPanel chartpanel = new ChartPanel(signatureG);
    chartpanel.setPreferredSize(new Dimension(390, 290));
    frame.setContentPane(chartpanel);
    frame.setDefaultCloseOperation(WindowConstants.DISPOSE_ON_CLOSE);

    frame.pack();
    frame.setSize(400, 300);
    frame.setVisible(true);
    if (name == " RED")
        frame.setLocation(0, 300);
    else
        frame.setLocation(400, 300);

}

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.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 w w  w  . j a  va2s .  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:controletanquesproj1.Grafico.java

public void createDatasets(ArrayList[] vetorDeItensDeGrafico) {

    setDatasets(new XYSeriesCollection[2]);

    for (int i = 0; i < getDatasets().length; i++) {
        getDatasets()[i] = new XYSeriesCollection();

        for (int j = 0; j < vetorDeItensDeGrafico[i].size(); j++) {
            ItemDeGrafico itemDeGrafico = (ItemDeGrafico) vetorDeItensDeGrafico[i].get(j);
            serie = new XYSeries(itemDeGrafico.getNome());

            for (int k = 0; k < itemDeGrafico.getPontos().size(); k++) {
                serie.add((double) ((Ponto) itemDeGrafico.getPontos().get(k)).getX(),
                        (double) ((Ponto) itemDeGrafico.getPontos().get(k)).getY());
            }//from  w w  w  .j  av  a  2 s. c om
            getDatasets()[i].addSeries(serie);
        }

    }
    getRenderer()[0] = new XYLineAndShapeRenderer();

    //return getDatasets();
}

From source file:clonalgtcc.PlotTest.java

public PlotTest(ArrayList<Anticorpo> iniciais, ArrayList<Antigeno> antigenos, ArrayList<Anticorpo> anticorpos,
        int it) {
    dataset = new XYSeriesCollection();
    XYSeries data1 = new XYSeries("Antgenos");
    //        XYSeries data2 = new XYSeries("Class2");
    //        XYSeries data3 = new XYSeries("Class3");
    //        XYSeries data4 = new XYSeries("Class4");
    XYSeries dataAnticorpos = new XYSeries("Anticorpos");
    XYSeries dataInicial = new XYSeries("Pop. Inicial");

    for (Antigeno antigeno : antigenos) {
        data1.add(antigeno.getVars().get(0), antigeno.getVars().get(1));
    }/*  ww w. j  av  a2 s .  com*/
    for (Anticorpo anticorpo : anticorpos) {
        dataAnticorpos.add(anticorpo.getVars().get(0), anticorpo.getVars().get(1));
    }
    for (Anticorpo inicial : iniciais) {
        dataInicial.add(inicial.getVars().get(0), inicial.getVars().get(1));
    }
    dataset.addSeries(data1);
    //        dataset.addSeries(data2);
    //        dataset.addSeries(data3);
    //        dataset.addSeries(data4);
    dataset.addSeries(dataAnticorpos);
    dataset.addSeries(dataInicial);

    showGraph(String.valueOf(it));
}

From source file:simphy.XYChart.java

public XYChart(Pendulum p) {
    this.p = p;/*from  w ww  .j  av a 2 s . co m*/
    type = "pendulum";
    // Create a simple XY chart
    series = new XYSeries("Omega-Time Plot");
    series1 = new XYSeries("Theta-Time Plot");
    dataset = new XYSeriesCollection();
    dataset.addSeries(series);
    dataset.addSeries(series1);
    // Generate the graph
    chart = ChartFactory.createXYLineChart("Velocity/Angle Graph", // Title
            "time", // x-axis Label
            "Angular Velocity(rad/s)/Angle(rad)", // y-axis Label
            dataset, // Dataset
            PlotOrientation.VERTICAL, // Plot Orientation
            true, // Show Legend
            true, // Use tooltips
            false // Configure chart to generate URLs?
    );
    this.setTitle(p.toString());
    this.setBounds(950, 0, 400, 700);
    panel = new ChartPanel(chart, false);
    this.add(panel, BorderLayout.CENTER);
    this.setAlwaysOnTop(true);
    this.addWindowListener(this);
    this.pack();

    SwingUtilities.invokeLater(new Runnable() {
        @Override
        public void run() {
            XYChart.this.setVisible(true);
        }
    });

}

From source file:com.kurvlrgui.gui.ChartPanel.java

/**
 * Creates new form ChartPanel//from  www . j  a  va2 s .com
 */
public ChartPanel(String title, NumericData s1, NumericData s2) {
    initComponents();

    calculated = new XYSeries("Calculated");
    for (NumericPair np : s1.values) {
        calculated.add(np.x, np.y);
    }

    observed = null;
    if (s2 != null) {
        observed = new XYSeries("Observed");
        for (NumericPair np : s2.values) {
            observed.add(np.x, np.y);
        }
    }

    XYSeriesCollection dataset = new XYSeriesCollection();
    dataset.addSeries(calculated);
    if (s2 != null)
        dataset.addSeries(observed);

    JFreeChart chart = ChartFactory.createXYLineChart(title, "X", "Y", dataset, PlotOrientation.VERTICAL, true,
            true, false);
    chart.setBackgroundPaint(Color.white);

    XYPlot plot = chart.getXYPlot();

    plot.setBackgroundPaint(Color.lightGray);
    plot.setDomainGridlinePaint(Color.white);
    plot.setRangeGridlinePaint(Color.white);

    XYLineAndShapeRenderer renderer = new XYLineAndShapeRenderer();
    renderer.setSeriesLinesVisible(0, false);
    renderer.setSeriesLinesVisible(1, false);

    NumberAxis rangeAxis = (NumberAxis) plot.getRangeAxis();
    rangeAxis.setStandardTickUnits(NumberAxis.createIntegerTickUnits());

    panel = new org.jfree.chart.ChartPanel(chart);

    panel.setHorizontalAxisTrace(true);
    panel.setVerticalAxisTrace(true);

    this.add(panel);
}

From source file:statistics.distribution.ConstantDistribution.java

private XYDataset getDataset() {
    XYSeriesCollection dataSet = new XYSeriesCollection();
    XYSeries xySeries = new XYSeries("CDF");
    double x = 0.0;
    for (int i = 0; i < 6; i++) {
        xySeries.add(5, x);//  ww  w  .j  av a2 s .c  o m
        x += 0.2;
    }
    dataSet.addSeries(xySeries);
    return dataSet;
}

From source file:graph_line.java

public void showGraph() {

    dataset = new XYSeriesCollection();
    dataset.addSeries(fftseries);/*www.j  a  v a2 s.c o  m*/
    //   dataset.addSeries(series1);
    //dataset.addSeries(series2);

    chart = ChartFactory.createXYLineChart("XY Chart", // Title
            "x-axis", // x-axis Label
            "y-axis", // y-axis Label
            dataset, // Dataset
            PlotOrientation.VERTICAL, // Plot Orientation
            true, // Show Legend
            true, // Use tooltips
            false);

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

    this.pack();
    this.setVisible(true);

    _active = 1;

}