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

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

Introduction

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

Prototype

public DefaultXYDataset() 

Source Link

Document

Creates a new DefaultXYDataset instance, initially containing no data.

Usage

From source file:edu.gmu.cs.sim.util.media.chart.ScatterPlotGenerator.java

protected void update() {
    // we'll rebuild the plot from scratch

    SeriesAttributes[] sa = getSeriesAttributes();
    //XYPlot xyplot = (XYPlot)(chart.getPlot());
    DefaultXYDataset dataset = new DefaultXYDataset();

    for (int i = 0; i < sa.length; i++) {
        ScatterPlotSeriesAttributes attributes = (ScatterPlotSeriesAttributes) (sa[i]);
        dataset.addSeries(new UniqueString(attributes.getSeriesName()), attributes.getValues());
    }/*www  . j av  a  2 s .  c  om*/

    setSeriesDataset(dataset);
}

From source file:com.idealista.solrmeter.view.statistic.QueryTimeHistoryPanel.java

@Inject
public QueryTimeHistoryPanel(QueryTimeHistoryStatistic queryTimeStatistic) {
    super();/*from  www. j av  a2  s . c  o m*/
    this.queryTimeStatistic = queryTimeStatistic;
    this.dataset = new DefaultXYDataset();
    this.add(createChartPanel());
}

From source file:Chart.JFreeChartDemo.java

/**
 * Construct a new frame//from   w w w.  j  a v a 2 s . c  o  m
 *
 * @param title the frame title
 */
public JFreeChartDemo(ArrayList<Time_Series> tslist, String title, int xd, int yd) {
    super(title);
    this.setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE);
    final DefaultXYDataset dataset = new DefaultXYDataset();

    for (int i = 0; i < tslist.size(); i++) {
        double[][] data = createSeries2(tslist.get(i));
        dataset.addSeries(tslist.get(i).name, data);
    }

    JFreeChart chart = createChart(dataset);
    ChartPanel chartPanel = new ChartPanel(chart, false);
    chartPanel.setPreferredSize(new Dimension(xd, yd)); //640, 480));
    this.add(chartPanel, BorderLayout.CENTER);

}

From source file:com.idealista.solrmeter.view.statistic.HistogramChartPanel.java

@Inject
public HistogramChartPanel(HistogramQueryStatistic histogram) {
    super();//w ww  .  java2  s  . c  o  m
    this.histogram = histogram;
    this.xyDataset = new DefaultXYDataset();
    this.add(createChartPanel());
}

From source file:org.jfree.data.xy.XYBarDatasetTest.java

/**
 * Confirm that the equals method can distinguish all the required fields.
 *//*from ww w . j ava 2 s.  com*/
@Test
public void testEquals() {
    DefaultXYDataset d1 = new DefaultXYDataset();
    double[] x1 = new double[] { 1.0, 2.0, 3.0 };
    double[] y1 = new double[] { 4.0, 5.0, 6.0 };
    double[][] data1 = new double[][] { x1, y1 };
    d1.addSeries("S1", data1);
    DefaultXYDataset d2 = new DefaultXYDataset();
    double[] x2 = new double[] { 1.0, 2.0, 3.0 };
    double[] y2 = new double[] { 4.0, 5.0, 6.0 };
    double[][] data2 = new double[][] { x2, y2 };
    d2.addSeries("S1", data2);

    XYBarDataset bd1 = new XYBarDataset(d1, 5.0);
    XYBarDataset bd2 = new XYBarDataset(d2, 5.0);
    assertTrue(bd1.equals(bd2));
    assertTrue(bd2.equals(bd1));
}

From source file:org.eurocarbdb.application.glycoworkbench.plugin.PeakAnnotationReportPanel.java

protected void initComponents() {
    setLayout(new BorderLayout());

    // create chart
    theDataset = new DefaultXYDataset();
    theChart = org.jfree.chart.ChartFactory.createScatterPlot("Annotation", "Count", "Intensity", theDataset,
            org.jfree.chart.plot.PlotOrientation.VERTICAL, true, false, false);
    thePlot = (XYPlot) theChart.getPlot();
    thePlot.setRenderer(new StandardXYItemRenderer(StandardXYItemRenderer.LINES));

    theChartPanel = new ChartPanel(theChart);
    theChartPanel.setDomainZoomable(true);
    theChartPanel.setRangeZoomable(false);
    //theChartPanel.setPopupMenu(null);
    add(theChartPanel, BorderLayout.CENTER);

    // create toolbar
    theToolBar = createToolBar();/*ww  w . j ava2 s  . c  o m*/
    add(theToolBar, BorderLayout.SOUTH);
}

From source file:org.jfree.data.xy.DefaultXYDatasetTest.java

/**
 * Confirm that the equals method can distinguish all the required fields.
 *//*from  ww  w.j  a  va 2  s . co m*/
@Test
public void testEquals() {

    DefaultXYDataset d1 = new DefaultXYDataset();
    DefaultXYDataset d2 = new DefaultXYDataset();
    assertTrue(d1.equals(d2));
    assertTrue(d2.equals(d1));

    double[] x1 = new double[] { 1.0, 2.0, 3.0 };
    double[] y1 = new double[] { 4.0, 5.0, 6.0 };
    double[][] data1 = new double[][] { x1, y1 };
    double[] x2 = new double[] { 1.0, 2.0, 3.0 };
    double[] y2 = new double[] { 4.0, 5.0, 6.0 };
    double[][] data2 = new double[][] { x2, y2 };
    d1.addSeries("S1", data1);
    assertFalse(d1.equals(d2));
    d2.addSeries("S1", data2);
    assertTrue(d1.equals(d2));
}

From source file:org.esa.beam.visat.toolviews.stat.XYImagePlot.java

public void setImageDataBounds(Rectangle2D imageDataBounds) {
    synchronized (imageLock) {
        this.imageDataBounds = (Rectangle2D) imageDataBounds.clone();
        DefaultXYDataset xyDataset = new DefaultXYDataset();
        xyDataset.addSeries("Image Data Bounds",
                new double[][] { { imageDataBounds.getMinX(), imageDataBounds.getMaxX() },
                        { imageDataBounds.getMinY(), imageDataBounds.getMaxY() } });
        setDataset(xyDataset);// w w  w.  j  ava  2s  .c  o  m
        getDomainAxis().setRange(imageDataBounds.getMinX(), imageDataBounds.getMaxX());
        getRangeAxis().setRange(imageDataBounds.getMinY(), imageDataBounds.getMaxY());
    }
}

From source file:org.openmicroscopy.shoola.util.ui.graphutils.ScatterPlot.java

/** Initializes. */
private void initialize() {
    data = new ArrayList<double[][]>();
    shapes = new ArrayList<Shape>();
    dataset = new DefaultXYDataset();
}