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:graficos.GraficoTorneios.java

public GraficoTorneios(String title, String xLabel, String yLabel) {
    series = new XYSeriesCollection();
    grafico = ChartFactory.createXYLineChart(title, xLabel, yLabel, series);
}

From source file:DATA.Grafica.java

public Grafica(String titulo) {
    this.titulo = titulo;
    this.coleccion = new XYSeriesCollection();
}

From source file:e3fraud.gui.GraphingTool.java

public static JFreeChart generateGraph(E3Model model, Resource need, int startValue, int endValue,
        boolean expected) {
    //Get list of actors
    Set<Resource> actors = model.getActors();
    //generate a series
    Map<Resource, XYSeries> actorSeriesMap = model.getTotalForActors(need, startValue, endValue, expected);

    //for each actor
    XYSeriesCollection line_chart_dataset = new XYSeriesCollection();

    for (Resource actor : actors) {
        //add it's series to the chart
        XYSeries series = actorSeriesMap.get(actor);
        line_chart_dataset.addSeries(series);
        double slope;
        if (series.getItemCount() > 1) {
            slope = (series.getY(0).doubleValue() - series.getY(1).doubleValue())
                    / (series.getX(0).doubleValue() - series.getX(1).doubleValue());
        } else {/*w w w .  jav a 2s.c  o m*/
            slope = 0;
        }
        DecimalFormat df = new DecimalFormat("#.##");
        series.setKey(series.getKey() + "\nAvg.\t = \t" + df.format(model.getLastKnownAverages().get(actor))
                + "\nSlope\t = \t" + df.format(slope));
    }

    /* Step -2:Define the JFreeChart object to create line chart */
    JFreeChart lineChartObject;
    if (expected) {
        lineChartObject = ChartFactory.createScatterPlot(
                "(Ideal) Profit Vs Occurences of \"" + need.getProperty(E3value.e3_has_name).getString()
                        + " \"",
                "Occurences of \"" + need.getProperty(E3value.e3_has_name).getString() + " \"",
                "Profit (in Euro)", line_chart_dataset, PlotOrientation.VERTICAL, true, true, false);
    } else {
        lineChartObject = ChartFactory.createScatterPlot(
                "(Non-ideal) Profit Vs Occurences of \"" + need.getProperty(E3value.e3_has_name).getString()
                        + " \"",
                "Occurences of \"" + need.getProperty(E3value.e3_has_name).getString() + " \"",
                "Profit (in Euro)", line_chart_dataset, PlotOrientation.VERTICAL, true, true, false);
    }
    return lineChartObject;
}

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 ww. j  a v  a2 s  .  com*/
    }

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

From source file:ec.display.chart.XYSeriesChartStatistics.java

public void setup(EvolutionState state, Parameter base) {
    super.setup(state, base);

    seriesCollection = new XYSeriesCollection();

}

From source file:Graphic.Poids.java

public Poids(List<Float> valeurs, List<String> date) {
    dataset = new XYSeriesCollection();
    XYSeries serie = new XYSeries("Courbe");
    for (int i = 0; i < valeurs.size(); i++) {
        serie.add(i, valeurs.get(i));/*w  w w.  j a v  a2s .c  om*/
    }
    dataset.addSeries(serie);
    diagramme = ChartFactory.createXYLineChart("Graphe de Poids", "Date", "Poids", dataset,
            PlotOrientation.VERTICAL, true, true, false);

    ChartPanel chartPanel = new ChartPanel(diagramme);
    chartPanel.setFillZoomRectangle(true);
    chartPanel.setMouseWheelEnabled(true);
    chartPanel.setPreferredSize(new Dimension(1200, 600));
    add(chartPanel);
}

From source file:edu.msu.cme.rdp.classifier.train.validation.distance.BoxPlotUtils.java

public static void readData(String inFile, File outdir, String xAxisLabel, String yAxisLabel)
        throws IOException {
    XYSeriesCollection dataset = new XYSeriesCollection();
    DefaultBoxAndWhiskerCategoryDataset scatterDataset = new DefaultBoxAndWhiskerCategoryDataset();

    BufferedReader reader = new BufferedReader(new FileReader(inFile));
    String line = reader.readLine();

    while ((line = reader.readLine()) != null) {
        String[] values = line.split("\\t");
        XYSeries series = new XYSeries(values[2]);
        dataset.addSeries(series);//w  ww  .  j a  v  a2  s . c o m

        double average = Double.parseDouble(values[4]);
        int Q1 = Integer.parseInt(values[6]);
        ;
        int median = Integer.parseInt(values[7]);
        int Q3 = Integer.parseInt(values[8]);
        int pct_98 = Integer.parseInt(values[9]);
        int pct_2 = Integer.parseInt(values[10]);
        int minOutlier = 0; // we don't care about the outliers
        int maxOutlier = 0; //

        BoxAndWhiskerItem item = new BoxAndWhiskerItem(average, median, Q1, Q3, pct_2, pct_98, minOutlier,
                maxOutlier, new ArrayList());
        scatterDataset.add(item, values[2], "");
    }

    String title = new File(inFile).getName();
    int index = title.indexOf(".");
    if (index != -1) {
        title = title.substring(0, index);
    }

    Font lableFont = new Font("Helvetica", Font.BOLD, 28);
    createBoxplot(scatterDataset, new PrintStream(new File(outdir, title + ".boxchart.png")), title, xAxisLabel,
            yAxisLabel, lableFont);

}

From source file:algoritmosdeordenamiento.Grafica.java

public Grafica(String nombre, String ty, String tx) {
    this.grafica = null;
    this.series = new XYSeriesCollection();
    this.nombre = nombre;
    this.tituloEjeX = tx;
    this.tituloEjeY = ty;

}

From source file:stratego.neural.net.RandomSampleTest.java

private static void plotDataSet(List<double[]> data) {

    XYSeriesCollection plotData = new XYSeriesCollection();

    for (double[] ds : data) {

        XYSeries series = new XYSeries("Winrate");

        for (int i = 0; i < ds.length; i++) {
            series.add((double) i, ds[i]);
        }/*from  w  w  w  . jav a2s.c o m*/

        plotData.addSeries(series);
    }

    String title = "Simulating Random Samples";
    String xAxisLabel = "Matches";
    String yAxisLabel = "Winrate";
    PlotOrientation orientation = PlotOrientation.VERTICAL;
    boolean legend = false; // might wanna set this to true at some point, but research the library
    boolean tooltips = false;
    boolean urls = false;
    JFreeChart chart = ChartFactory.createScatterPlot(title, xAxisLabel, yAxisLabel, plotData, orientation,
            legend, tooltips, urls);

    JPanel panel = new ChartPanel(chart);

    JFrame f = new JFrame();
    f.add(panel);
    f.setDefaultCloseOperation(WindowConstants.EXIT_ON_CLOSE);
    f.pack();
    f.setTitle("Random test simulation");

    f.setVisible(true);
}

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

private static XYDataset createDataset() {
    XYSeries xyseries = new XYSeries("Series 1");
    xyseries.add(0.0D, 3D);/* www. j a v a 2  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;
}