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:org.rhwlab.ace3d.SegmentationLinePlot.java

public void setTree(BHCTree tree) {
    XYSeriesCollection collect = new XYSeriesCollection();
    XYSeries series = new XYSeries("");
    collect.addSeries(series);/*w w  w .jav a2  s . c  o  m*/

    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));

    }
    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:view.visualization.TXTVisualization.java

public static void drawChart(String a, String b, String txt) {
    String[] boje = null;//from   w w w  .j  av  a  2s.  c o  m
    LinkedList<String> atributi = new LinkedList<String>();
    LinkedList<String> sviAtributi = new LinkedList<String>();
    String[] vrAtribut = null;
    XYSeries[] xy = null;
    XYSeriesCollection xySeriesCollection = new XYSeriesCollection();
    int brojac = 0;
    boolean kraj = false;
    LinkedList<Integer> numeric = new LinkedList<Integer>();

    try {
        BufferedReader in = new BufferedReader(new FileReader(txt));
        int br = Integer.parseInt(in.readLine().split(" ")[1]);
        for (int j = 0; j < br + 1; j++) {

            String pom = in.readLine();
            if (pom.contains("@attribute")) {
                if (pom.contains("numeric")) {
                    sviAtributi.add(pom.substring(11, pom.lastIndexOf("n") - 1));
                } else {
                    sviAtributi.add(pom.split(" ")[1]);
                }
            }
            if (pom.contains("@attribute") && pom.contains("numeric")) {
                atributi.add(pom.substring(11, pom.lastIndexOf("n") - 1));
            }
            if (!pom.contains("numeric")) {
                brojac++;
                numeric.add(j - 2);
            }

        }
        String s = in.readLine();
        boje = s.substring(s.indexOf("{") + 1, s.lastIndexOf("}")).split(",");
        xy = new XYSeries[boje.length];
        for (int i = 0; i < boje.length; i++) {

            xy[i] = new XYSeries(boje[i]);

        }
        while (!kraj) {
            String pom2 = in.readLine();

            if (!(pom2.contains("@data"))) {
                vrAtribut = pom2.split(",");
                for (int i = 0; i < xy.length; i++) {
                    if (xy[i].getKey().equals(vrAtribut[vrAtribut.length - 1])) {

                        xy[i].add(Double.parseDouble(vrAtribut[sviAtributi.indexOf(a)]),
                                Double.parseDouble(vrAtribut[sviAtributi.indexOf(b)]));

                    }
                }
            }
        }
        in.close();
    } catch (Exception e) {
        e.getMessage();
    }
    for (int i = 0; i < xy.length; i++) {
        xySeriesCollection.addSeries(xy[i]);
    }

    JFreeChart grafik = ChartFactory.createScatterPlot("Vizuelizacija", a, b, xySeriesCollection,
            PlotOrientation.VERTICAL, true, true, false);
    ChartFrame proba = new ChartFrame("DataMiner", grafik);

    proba.setVisible(true);
    proba.setSize(500, 600);

}

From source file:simulador.controle.GraficoCategorias.java

private static XYSeriesCollection criarDataset(Map<String, Map<Float, Float>> dadosRadios) {

    if (DEBUG) {//from w ww. ja v a 2s .c  o m
        System.out.println("GraficoRadiais.criarDataset");
    }

    XYSeriesCollection colecaoParesXY = new XYSeriesCollection();

    for (Map.Entry<String, Map<Float, Float>> parDadosRadios : dadosRadios.entrySet()) {

        Map<Float, Float> dadosRadio = parDadosRadios.getValue();
        XYSeries paresXY = new XYSeries(parDadosRadios.getKey());

        for (Map.Entry<Float, Float> parDadosRadio : dadosRadio.entrySet()) {

            float d = parDadosRadio.getKey();
            float p = parDadosRadio.getValue();

            //System.out.println("d = "+d);
            //System.out.println("p = "+p);

            paresXY.add(parDadosRadio.getKey(), parDadosRadio.getValue());

        }

        colecaoParesXY.addSeries(paresXY);

    }

    return colecaoParesXY;

}

From source file:logica_controladores.controlador_estadistica.java

public static void grafica_orden(JPanel panel_grafica_orden, Inventario inventario, JLabel lbLinea) {
    XYSeries serie = null;//from w ww  . ja v  a2 s .  co  m
    XYSeries serie_2 = null;

    JFreeChart linea;

    serie = new XYSeries("graficas relacion gastos-orden");
    Gasto gasto_minimo = valor_minimo(inventario);
    Gasto gasto_max = valor_maximo(inventario);
    for (int i = 0; i < inventario.getGastos().size(); i = i + inventario.getReorden_max()) {
        serie.add(inventario.getGastos().get(i).getOrden_inicial(), inventario.getGastos().get(i).getGastos());
    }
    serie_2 = new XYSeries("graficas relacion gastos-reorden");

    for (int i = 0; i < inventario.getGastos().size(); i = i + inventario.getOrden_max()) {
        serie_2.add(inventario.getGastos().get(i).getReorden(), inventario.getGastos().get(i).getGastos());
    }
    final XYSeriesCollection datos = new XYSeriesCollection();
    datos.addSeries(serie);
    datos.addSeries(serie_2);

    linea = ChartFactory.createXYLineChart(
            "grafica representativa de ordenes por corrida, gasto_minimo(orden: "
                    + gasto_minimo.getOrden_inicial() + "reorden: " + gasto_minimo.getReorden() + ")= "
                    + gasto_minimo.getGastos(),
            "rango", "gastos", datos, PlotOrientation.VERTICAL, true, true, true);
    final XYPlot plot = (XYPlot) linea.getPlot();
    final NumberAxis domainAxis = (NumberAxis) plot.getDomainAxis();
    final NumberAxis rangeAxis = (NumberAxis) plot.getRangeAxis();
    configurarDomainAxis(domainAxis, inventario);
    configurarRangeAxis(rangeAxis, gasto_minimo.getGastos(), gasto_max.getGastos());
    BufferedImage graficoLinea = linea.createBufferedImage(600, 280);
    lbLinea.setSize(panel_grafica_orden.getSize());
    lbLinea.setIcon(new ImageIcon(graficoLinea));
    panel_grafica_orden.updateUI();
}

From source file:org.chocosolver.gui.panels.DepthPanel.java

public DepthPanel(GUI frame) {
    super(frame);
    depth = new XYSeries("Depth");
    XYSeriesCollection scoll = new XYSeriesCollection();
    scoll.addSeries(depth);/*from   ww w  .j  a  va 2  s  .c o m*/
    JFreeChart chart = ChartFactory.createXYLineChart("Depth", "Nodes", "Depth", scoll);
    this.setChart(chart);
    solver.plugMonitor(this);
}

From source file:graficar.Graficar.java

/**
 * @param args the command line arguments
 */
public Graficar() {
    dataset = new XYSeriesCollection();
}

From source file:sentimentBarometer.view.Chart.java

public Chart() {
    _dataset = new XYSeriesCollection();
    _series = new XYSeries("Rating over number Emotional Words");
    _dataset.addSeries(_series);
}

From source file:org.chocosolver.gui.panels.FreeVarsPanel.java

public FreeVarsPanel(GUI frame) {
    super(frame);
    series = new XYSeries("Free variables");
    XYSeriesCollection scoll = new XYSeriesCollection();
    scoll.addSeries(series);//from  w  ww  . j  ava  2  s .c o m
    JFreeChart chart = ChartFactory.createXYLineChart("Free variables", "Nodes", "free vars", scoll);
    this.setChart(chart);
    solver.plugMonitor(this);
}

From source file:geneticonreinas.data.Grafica.java

public Grafica(String tituloGrafica, String axisXlabel, String axisYlabel) {
    this.tituloGrafica = tituloGrafica;
    this.axisXlabel = axisXlabel;
    this.axisYlabel = axisYlabel;
    this.coleccion = new XYSeriesCollection();
    this.grafica = null;
}

From source file:views.analysis.ResidualPlotDisplay.java

public XYDataset createDataset() {
    XYSeriesCollection dataset = new XYSeriesCollection();
    XYSeries serie = new XYSeries("Rsidu");
    for (Point p : this.dataList) {
        double value = p.getValue();
        serie.add(p.getX(), value);/*from  w  w  w  . j a  v  a 2 s  .co m*/
    }
    dataset.addSeries(serie);
    return dataset;
}