Search in sources :

Example 21 with DefaultXYDataset

use of org.jfree.data.xy.DefaultXYDataset in project SIMVA-SoS by SESoS.

the class ChartPanelTest method test2502355_restoreAutoBounds.

/**
 * Checks that a call to the restoreAutoBounds() method generates just one
 * ChartChangeEvent.
 */
@Test
public void test2502355_restoreAutoBounds() {
    DefaultXYDataset dataset = new DefaultXYDataset();
    JFreeChart chart = ChartFactory.createXYLineChart("TestChart", "X", "Y", dataset, PlotOrientation.VERTICAL, false, false, false);
    ChartPanel panel = new ChartPanel(chart);
    chart.addChangeListener(this);
    this.chartChangeEvents.clear();
    panel.restoreAutoBounds();
    assertEquals(1, this.chartChangeEvents.size());
}
Also used : DefaultXYDataset(org.jfree.data.xy.DefaultXYDataset) Test(org.junit.Test)

Example 22 with DefaultXYDataset

use of org.jfree.data.xy.DefaultXYDataset in project SIMVA-SoS by SESoS.

the class ChartPanelTest method test2502355_zoomOutDomain.

/**
 * Checks that a call to the zoomOutDomain() method, for a plot with more
 * than one domain axis, generates just one ChartChangeEvent.
 */
@Test
public void test2502355_zoomOutDomain() {
    DefaultXYDataset dataset = new DefaultXYDataset();
    JFreeChart chart = ChartFactory.createXYLineChart("TestChart", "X", "Y", dataset, PlotOrientation.VERTICAL, false, false, false);
    XYPlot plot = (XYPlot) chart.getPlot();
    plot.setDomainAxis(1, new NumberAxis("X2"));
    ChartPanel panel = new ChartPanel(chart);
    chart.addChangeListener(this);
    this.chartChangeEvents.clear();
    panel.zoomOutDomain(1.0, 2.0);
    assertEquals(1, this.chartChangeEvents.size());
}
Also used : NumberAxis(org.jfree.chart.axis.NumberAxis) XYPlot(org.jfree.chart.plot.XYPlot) DefaultXYDataset(org.jfree.data.xy.DefaultXYDataset) Test(org.junit.Test)

Example 23 with DefaultXYDataset

use of org.jfree.data.xy.DefaultXYDataset in project SIMVA-SoS by SESoS.

the class ChartPanelTest method test2502355_zoomInDomain.

/**
 * Checks that a call to the zoomInDomain() method, for a plot with more
 * than one domain axis, generates just one ChartChangeEvent.
 */
@Test
public void test2502355_zoomInDomain() {
    DefaultXYDataset dataset = new DefaultXYDataset();
    JFreeChart chart = ChartFactory.createXYLineChart("TestChart", "X", "Y", dataset, PlotOrientation.VERTICAL, false, false, false);
    XYPlot plot = (XYPlot) chart.getPlot();
    plot.setDomainAxis(1, new NumberAxis("X2"));
    ChartPanel panel = new ChartPanel(chart);
    chart.addChangeListener(this);
    this.chartChangeEvents.clear();
    panel.zoomInDomain(1.0, 2.0);
    assertEquals(1, this.chartChangeEvents.size());
}
Also used : NumberAxis(org.jfree.chart.axis.NumberAxis) XYPlot(org.jfree.chart.plot.XYPlot) DefaultXYDataset(org.jfree.data.xy.DefaultXYDataset) Test(org.junit.Test)

Example 24 with DefaultXYDataset

use of org.jfree.data.xy.DefaultXYDataset in project SIMVA-SoS by SESoS.

the class ChartPanelTest method test2502355_zoomOutBoth.

/**
 * Checks that a call to the zoomOutBoth() method generates just one
 * ChartChangeEvent.
 */
@Test
public void test2502355_zoomOutBoth() {
    DefaultXYDataset dataset = new DefaultXYDataset();
    JFreeChart chart = ChartFactory.createXYLineChart("TestChart", "X", "Y", dataset, PlotOrientation.VERTICAL, false, false, false);
    ChartPanel panel = new ChartPanel(chart);
    chart.addChangeListener(this);
    this.chartChangeEvents.clear();
    panel.zoomOutBoth(1.0, 2.0);
    assertEquals(1, this.chartChangeEvents.size());
}
Also used : DefaultXYDataset(org.jfree.data.xy.DefaultXYDataset) Test(org.junit.Test)

Example 25 with DefaultXYDataset

use of org.jfree.data.xy.DefaultXYDataset in project SIMVA-SoS by SESoS.

the class XYPlotTest method testDrawSeriesWithZeroItems.

/**
 * A test for drawing a plot where a series has zero items.  With
 * JFreeChart 1.0.5+cvs this was throwing an exception at one point.
 */
@Test
public void testDrawSeriesWithZeroItems() {
    DefaultXYDataset dataset = new DefaultXYDataset();
    dataset.addSeries("Series 1", new double[][] { { 1.0, 2.0 }, { 3.0, 4.0 } });
    dataset.addSeries("Series 2", new double[][] { {}, {} });
    JFreeChart chart = ChartFactory.createXYLineChart("Title", "X", "Y", dataset, PlotOrientation.VERTICAL, true, false, false);
    try {
        BufferedImage image = new BufferedImage(200, 100, BufferedImage.TYPE_INT_RGB);
        Graphics2D g2 = image.createGraphics();
        chart.draw(g2, new Rectangle2D.Double(0, 0, 200, 100), null, null);
        g2.dispose();
    } catch (Exception e) {
        fail("No exception should be thrown.");
    }
}
Also used : DefaultXYDataset(org.jfree.data.xy.DefaultXYDataset) Rectangle2D(java.awt.geom.Rectangle2D) JFreeChart(org.jfree.chart.JFreeChart) BufferedImage(java.awt.image.BufferedImage) Graphics2D(java.awt.Graphics2D) Test(org.junit.Test)

Aggregations

DefaultXYDataset (org.jfree.data.xy.DefaultXYDataset)28 Test (org.junit.Test)24 JFreeChart (org.jfree.chart.JFreeChart)8 NumberAxis (org.jfree.chart.axis.NumberAxis)7 XYPlot (org.jfree.chart.plot.XYPlot)7 Rectangle2D (java.awt.geom.Rectangle2D)4 BufferedImage (java.awt.image.BufferedImage)4 Graphics2D (java.awt.Graphics2D)3 Range (org.jfree.data.Range)3 File (java.io.File)2 FileOutputStream (java.io.FileOutputStream)2 OutputStream (java.io.OutputStream)2 List (java.util.List)2 JFrame (javax.swing.JFrame)2 ChartPanel (org.jfree.chart.ChartPanel)2 XYSplineRenderer (org.jfree.chart.renderer.xy.XYSplineRenderer)2 VCellHelper (org.vcell.imagej.helper.VCellHelper)2 IJDataList (org.vcell.imagej.helper.VCellHelper.IJDataList)2 IJTimeSeriesJobResults (org.vcell.imagej.helper.VCellHelper.IJTimeSeriesJobResults)2 IJVarInfos (org.vcell.imagej.helper.VCellHelper.IJVarInfos)2