Search in sources :

Example 51 with CategoryPlot

use of org.jfree.chart.plot.CategoryPlot in project SIMVA-SoS by SESoS.

the class StatisticalBarRendererTest method testDrawWithNullMeanVertical.

/**
 * Draws the chart with a <code>null</code> mean value to make sure that
 * no exceptions are thrown (particularly by code in the renderer).  See
 * bug report 1779941.
 */
@Test
public void testDrawWithNullMeanVertical() {
    try {
        DefaultStatisticalCategoryDataset dataset = new DefaultStatisticalCategoryDataset();
        dataset.add(1.0, 2.0, "S1", "C1");
        dataset.add(null, new Double(4.0), "S1", "C2");
        CategoryPlot plot = new CategoryPlot(dataset, new CategoryAxis("Category"), new NumberAxis("Value"), new StatisticalBarRenderer());
        JFreeChart chart = new JFreeChart(plot);
        /* BufferedImage image = */
        chart.createBufferedImage(300, 200, null);
    } catch (NullPointerException e) {
        fail("No exception should be thrown.");
    }
}
Also used : DefaultStatisticalCategoryDataset(org.jfree.data.statistics.DefaultStatisticalCategoryDataset) NumberAxis(org.jfree.chart.axis.NumberAxis) CategoryAxis(org.jfree.chart.axis.CategoryAxis) CategoryPlot(org.jfree.chart.plot.CategoryPlot) JFreeChart(org.jfree.chart.JFreeChart) Test(org.junit.Test)

Example 52 with CategoryPlot

use of org.jfree.chart.plot.CategoryPlot in project SIMVA-SoS by SESoS.

the class StatisticalBarRendererTest method testDrawWithNullDeviationVertical.

/**
 * Draws the chart with a <code>null</code> standard deviation to make sure
 * that no exceptions are thrown (particularly by code in the renderer).
 * See bug report 1779941.
 */
@Test
public void testDrawWithNullDeviationVertical() {
    try {
        DefaultStatisticalCategoryDataset dataset = new DefaultStatisticalCategoryDataset();
        dataset.add(1.0, 2.0, "S1", "C1");
        dataset.add(new Double(4.0), null, "S1", "C2");
        CategoryPlot plot = new CategoryPlot(dataset, new CategoryAxis("Category"), new NumberAxis("Value"), new StatisticalBarRenderer());
        JFreeChart chart = new JFreeChart(plot);
        /* BufferedImage image = */
        chart.createBufferedImage(300, 200, null);
    } catch (NullPointerException e) {
        fail("No exception should be thrown.");
    }
}
Also used : DefaultStatisticalCategoryDataset(org.jfree.data.statistics.DefaultStatisticalCategoryDataset) NumberAxis(org.jfree.chart.axis.NumberAxis) CategoryAxis(org.jfree.chart.axis.CategoryAxis) CategoryPlot(org.jfree.chart.plot.CategoryPlot) JFreeChart(org.jfree.chart.JFreeChart) Test(org.junit.Test)

Example 53 with CategoryPlot

use of org.jfree.chart.plot.CategoryPlot in project SIMVA-SoS by SESoS.

the class StatisticalBarRendererTest method testDrawWithNullInfo.

/**
 * Draws the chart with a <code>null</code> info object to make sure that
 * no exceptions are thrown (particularly by code in the renderer).
 */
@Test
public void testDrawWithNullInfo() {
    try {
        DefaultStatisticalCategoryDataset dataset = new DefaultStatisticalCategoryDataset();
        dataset.add(1.0, 2.0, "S1", "C1");
        dataset.add(3.0, 4.0, "S1", "C2");
        CategoryPlot plot = new CategoryPlot(dataset, new CategoryAxis("Category"), new NumberAxis("Value"), new StatisticalBarRenderer());
        JFreeChart chart = new JFreeChart(plot);
        /* BufferedImage image = */
        chart.createBufferedImage(300, 200, null);
    } catch (NullPointerException e) {
        fail("No exception should be thrown.");
    }
}
Also used : DefaultStatisticalCategoryDataset(org.jfree.data.statistics.DefaultStatisticalCategoryDataset) NumberAxis(org.jfree.chart.axis.NumberAxis) CategoryAxis(org.jfree.chart.axis.CategoryAxis) CategoryPlot(org.jfree.chart.plot.CategoryPlot) JFreeChart(org.jfree.chart.JFreeChart) Test(org.junit.Test)

Example 54 with CategoryPlot

use of org.jfree.chart.plot.CategoryPlot in project SIMVA-SoS by SESoS.

the class StatisticalBarRendererTest method testDrawWithNullDeviationHorizontal.

/**
 * Draws the chart with a <code>null</code> standard deviation to make sure
 * that no exceptions are thrown (particularly by code in the renderer).
 * See bug report 1779941.
 */
@Test
public void testDrawWithNullDeviationHorizontal() {
    try {
        DefaultStatisticalCategoryDataset dataset = new DefaultStatisticalCategoryDataset();
        dataset.add(1.0, 2.0, "S1", "C1");
        dataset.add(new Double(4.0), null, "S1", "C2");
        CategoryPlot plot = new CategoryPlot(dataset, new CategoryAxis("Category"), new NumberAxis("Value"), new StatisticalBarRenderer());
        plot.setOrientation(PlotOrientation.HORIZONTAL);
        JFreeChart chart = new JFreeChart(plot);
        /* BufferedImage image = */
        chart.createBufferedImage(300, 200, null);
    } catch (NullPointerException e) {
        fail("No exception should be thrown.");
    }
}
Also used : DefaultStatisticalCategoryDataset(org.jfree.data.statistics.DefaultStatisticalCategoryDataset) NumberAxis(org.jfree.chart.axis.NumberAxis) CategoryAxis(org.jfree.chart.axis.CategoryAxis) CategoryPlot(org.jfree.chart.plot.CategoryPlot) JFreeChart(org.jfree.chart.JFreeChart) Test(org.junit.Test)

Example 55 with CategoryPlot

use of org.jfree.chart.plot.CategoryPlot in project SIMVA-SoS by SESoS.

the class AbstractRendererTest method testFillPaintLookup.

/**
 * Some checks for the fill paint lookup mechanism.
 */
@Test
public void testFillPaintLookup() {
    BarRenderer r = new BarRenderer();
    assertEquals(Color.white, r.getBaseFillPaint());
    // first check that autoPopulate==false works as expected
    r.setAutoPopulateSeriesFillPaint(false);
    assertEquals(Color.white, r.lookupSeriesFillPaint(0));
    assertNull(r.getSeriesFillPaint(0));
    // now check autoPopulate==true
    r.setAutoPopulateSeriesFillPaint(true);
    /*CategoryPlot plot =*/
    new CategoryPlot(null, new CategoryAxis("Category"), new NumberAxis("Value"), r);
    assertEquals(DefaultDrawingSupplier.DEFAULT_FILL_PAINT_SEQUENCE[0], r.lookupSeriesFillPaint(0));
    assertNotNull(r.getSeriesFillPaint(0));
}
Also used : NumberAxis(org.jfree.chart.axis.NumberAxis) CategoryAxis(org.jfree.chart.axis.CategoryAxis) BarRenderer(org.jfree.chart.renderer.category.BarRenderer) CategoryPlot(org.jfree.chart.plot.CategoryPlot) Test(org.junit.Test)

Aggregations

CategoryPlot (org.jfree.chart.plot.CategoryPlot)189 JFreeChart (org.jfree.chart.JFreeChart)94 CategoryAxis (org.jfree.chart.axis.CategoryAxis)88 NumberAxis (org.jfree.chart.axis.NumberAxis)80 Test (org.junit.Test)72 DefaultCategoryDataset (org.jfree.data.category.DefaultCategoryDataset)44 CategoryItemRenderer (org.jfree.chart.renderer.category.CategoryItemRenderer)36 ValueAxis (org.jfree.chart.axis.ValueAxis)35 BarRenderer (org.jfree.chart.renderer.category.BarRenderer)32 CategoryDataset (org.jfree.data.category.CategoryDataset)29 StandardCategoryToolTipGenerator (org.jfree.chart.labels.StandardCategoryToolTipGenerator)27 StandardCategoryURLGenerator (org.jfree.chart.urls.StandardCategoryURLGenerator)24 Paint (java.awt.Paint)23 DefaultBoxAndWhiskerCategoryDataset (org.jfree.data.statistics.DefaultBoxAndWhiskerCategoryDataset)16 LegendItem (org.jfree.chart.LegendItem)15 LineAndShapeRenderer (org.jfree.chart.renderer.category.LineAndShapeRenderer)13 RectangleInsets (org.jfree.ui.RectangleInsets)13 ArrayList (java.util.ArrayList)11 ChartRenderingInfo (org.jfree.chart.ChartRenderingInfo)11 XYPlot (org.jfree.chart.plot.XYPlot)11