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:figs.Chart.java

public Chart() {
    super(null, true);
    dataset = new XYSeriesCollection();
    chart = ChartFactory.createXYLineChart("", null, null, dataset, PlotOrientation.VERTICAL, true, true,
            false);/*w w  w. j ava2 s  . c  o  m*/

    chart.setBackgroundPaint(Color.white);
    setChart(chart);
}

From source file:org.rhwlab.ace3d.VolumeIntensityPlot.java

public VolumeIntensityPlot(ImagedEmbryo emb) {
    this.embryo = emb;
    collect = new XYSeriesCollection();
    series = new XYSeries("Nuclei");
    collect.addSeries(series);/* w  w  w .  j  a  v a2 s  .  com*/
    chart = ChartFactory.createScatterPlot("", "Volume", "AvgIntensity", collect, PlotOrientation.VERTICAL,
            false, true, true);
    XYPlot plot = (XYPlot) chart.getPlot();
    plot.setDomainCrosshairVisible(true);
    plot.setRangeCrosshairVisible(true);
    XYDotRenderer renderer = new XYDotRenderer();
    renderer.setDotHeight(4);
    renderer.setDotWidth(4);
    //        plot.setRenderer(renderer);
    ChartPanel panel = new ChartPanel(chart);
    panel.addChartMouseListener(new ChartMouseListener() {
        @Override
        public void chartMouseClicked(ChartMouseEvent event) {
            ChartEntity entity = event.getEntity();
            if (entity instanceof XYItemEntity) {
                XYItemEntity xyEntity = (XYItemEntity) entity;
                NucleusPlotDataItem item = (NucleusPlotDataItem) series.getDataItem(xyEntity.getItem());
                embryo.setSelectedNucleus(item.nuc);
            }
        }

        @Override
        public void chartMouseMoved(ChartMouseEvent event) {

        }
    });
    this.add(panel);
    embryo.getNucleusFile().addSelectionOberver(this);
}

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

public Graphic(String title) {

    this.title = title;

    mas_x.add((double) 0);
    mas_y.add((double) 0);

    dataset = new XYSeriesCollection();
    chart = ChartFactory.createXYLineChart(title, "T -  ", "U - ", dataset,
            PlotOrientation.VERTICAL, true, true, false);
    XYPlot plot = chart.getXYPlot();/*w ww  . j  av  a 2  s . co m*/

    plot.setDomainCrosshairLockedOnData(true);
    plot.setDomainCrosshairVisible(true);
    plot.setRangeCrosshairVisible(true);
    plot.setRangeCrosshairLockedOnData(true);

}

From source file:scheduler.benchmarker.manager.CreateCombinedSplineChart.java

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

    int index = 0;
    for (SimulatorResults simulatedResult : dataSource) {
        XYSeries cpuTime = new XYSeries(sName[index] + ": CPU");
        XYSeries ioTime = new XYSeries(sName[index] + ": IO");
        double i = 0D;
        for (PlanningResult p : simulatedResult.getPlanningResult()) {
            cpuTime.add(i, p.getTotalCPUTime());
            ioTime.add(i, p.getTotalIOTime());
            i++;/*from  w  ww  . jav a  2  s.co m*/
        }
        dataset.addSeries(cpuTime);
        dataset.addSeries(ioTime);
        index++;
    }
    return dataset;
}

From source file:cgpanalyser.gui.chart.ChartCreator.java

private XYDataset createDataset(GraphDataSampler gDataSampler) {
    if (gDataSampler == null)
        return null;

    XYSeries series1 = new XYSeries("Generation, Fitness");

    for (Generation generation : gDataSampler.getLastToDisplay()) {
        series1.add(generation.getGenNumber(), generation.getBestChromosome().getFitness());
    }/*from w  ww  . jav a 2  s  .  c o m*/

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

From source file:moviedatas.View.GlobalChart.java

public JPanel initView() {
    observer = this;
    ArrayList<Movie> movies = MovieListController.allMovies;
    XYSeries series = new XYSeries("Movie");
    for (int i = 0; i < movies.size(); i++) {
        Movie currentMovie = movies.get(i);
        series.add(currentMovie.getGross(), currentMovie.getScore());
    }// ww  w .  jav  a2 s.  co  m
    XYSeriesCollection dataset = new XYSeriesCollection();
    dataset.addSeries(series);
    JFreeChart scatterPlot = ChartFactory.createScatterPlot("", "Gross (in $)", "Score", dataset, VERTICAL,
            true, true, false);

    cPanel = new ChartPanel(scatterPlot);
    cPanel.setPreferredSize(new Dimension(500, 250));
    return cPanel;
}

From source file:app.gui.ViewGraphic.java

public ViewGraphic(String title) {
    setSize(600, 400);/*w w w  .  ja  v  a2 s .c o  m*/
    setLocationRelativeTo(this);
    setTitle(title);

    addWindowListener(new WindowAdapter() {
        @Override
        public void windowClosing(WindowEvent arg0) {
            dispose();
        }
    });
    setLayout(new BorderLayout());

    serieError = new XYSeries(title);

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

    chart = ChartFactory.createXYLineChart(title, Translate.get("GUI_PERIODS"), Translate.get("GUI_ERROR"),
            dataset, PlotOrientation.VERTICAL, true, true, false);
    add(new ChartPanel(chart), BorderLayout.CENTER);

    JPanel south = new JPanel(new MigLayout());

    lblError = new JLabel("");
    lblError.setHorizontalTextPosition(SwingConstants.LEFT);
    lblError.setFont(new Font("ARIAL", Font.BOLD, 26));
    JLabel lblErrorTitle = new JLabel(Translate.get("GUI_ERROR") + ": ");
    lblErrorTitle.setFont(new Font("ARIAL", Font.BOLD, 26));
    south.add(lblErrorTitle);
    south.add(lblError, "wrap");

    add(south, BorderLayout.SOUTH);
    setVisible(true);
}

From source file:neuronspike.NetPlot.java

public NetPlot(String l, String x, String y, int cutoff, int ybound) {
    label = l;/*from  w  ww  .ja  v a 2 s . c om*/
    x_label = x;
    y_label = y;
    limit_y = ybound;
    spikes = new XYSeries("Spike");
    series = new XYSeriesCollection();
    series.addSeries(spikes);
    chart = createChart();
    cutoffInterval = cutoff;
}

From source file:web.diva.server.model.LineChartGenerator.java

/**
 *
 * @return dataset./* w ww .  j a  va  2  s  . c  o m*/
 */
private XYDataset createDataset(Number[][] pointsData, String[] geneNames, int[] selection) {

    final XYSeriesCollection dataset = new XYSeriesCollection();
    if (selection == null) {
        for (int x = 0; x < pointsData.length; x++) {
            XYSeries series = new XYSeries(geneNames[x] + x);
            Number[] data = pointsData[x];
            for (int y = 0; y < data.length; y++) {
                series.add(y, data[y]);
            }
            dataset.addSeries(series);

        }
    } else {

        for (int x = 0; x < selection.length; x++) {
            XYSeries series = new XYSeries(geneNames[selection[x]]);
            Number[] data = pointsData[selection[x]];
            for (int y = 0; y < data.length; y++) {
                series.add(y, data[y]);
            }
            dataset.addSeries(series);

        }

    }

    return dataset;

}

From source file:ip.ui.plot.PlotGenerator.java

public void generateErrorChart(List<Double> errors, String plotFileName) throws IOException {
    XYSeries data = new XYSeries("Errors");

    for (int i = 1; i <= errors.size(); ++i) {
        data.add(i, errors.get(i - 1));//from  w  w  w  .  ja va  2 s .c o m
    }

    XYSeriesCollection dataset = new XYSeriesCollection();
    dataset.addSeries(data);
    JFreeChart chart = ChartFactory.createXYLineChart("Squared error", "Epoch number", "Squared Error", dataset,
            PlotOrientation.VERTICAL, false, true, true);

    XYLineAndShapeRenderer renderer = new XYLineAndShapeRenderer();
    renderer.setSeriesLinesVisible(0, false);
    chart.getXYPlot().setRenderer(renderer);

    File XYChart = new File(plotFileName);
    ChartUtilities.saveChartAsJPEG(XYChart, chart, chartWidth, chartHeight);
}