Java Code Examples for org.jfree.data.statistics.DefaultStatisticalCategoryDataset#add()
The following examples show how to use
org.jfree.data.statistics.DefaultStatisticalCategoryDataset#add() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: StatisticalBarRendererTest.java From buffer_bci with GNU General Public License v3.0 | 6 votes |
/** * 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."); } }
Example 2
Source File: StatisticalBarRendererTest.java From SIMVA-SoS with Apache License 2.0 | 6 votes |
/** * 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 testDrawWithNullMeanHorizontal() { 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()); 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."); } }
Example 3
Source File: StatisticalBarRendererTests.java From astor with GNU General Public License v2.0 | 6 votes |
/** * 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. */ public void testDrawWithNullMeanHorizontal() { boolean success = false; 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()); plot.setOrientation(PlotOrientation.HORIZONTAL); JFreeChart chart = new JFreeChart(plot); /* BufferedImage image = */ chart.createBufferedImage(300, 200, null); success = true; } catch (NullPointerException e) { e.printStackTrace(); success = false; } assertTrue(success); }
Example 4
Source File: StatisticalBarRendererTest.java From SIMVA-SoS with Apache License 2.0 | 6 votes |
/** * 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."); } }
Example 5
Source File: StatisticalBarRendererTest.java From ECG-Viewer with GNU General Public License v2.0 | 6 votes |
/** * 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."); } }
Example 6
Source File: StatisticalBarRendererTests.java From astor with GNU General Public License v2.0 | 6 votes |
/** * 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. */ public void testDrawWithNullDeviationVertical() { boolean success = false; 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); success = true; } catch (NullPointerException e) { e.printStackTrace(); success = false; } assertTrue(success); }
Example 7
Source File: StatisticalBarRendererTest.java From ccu-historian with GNU General Public License v3.0 | 6 votes |
/** * 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."); } }
Example 8
Source File: StatisticalBarRendererTests.java From astor with GNU General Public License v2.0 | 6 votes |
/** * 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. */ public void testDrawWithNullMeanVertical() { boolean success = false; 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); success = true; } catch (NullPointerException e) { e.printStackTrace(); success = false; } assertTrue(success); }
Example 9
Source File: StatisticalBarRendererTests.java From astor with GNU General Public License v2.0 | 6 votes |
/** * 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. */ public void testDrawWithNullMeanHorizontal() { boolean success = false; 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()); plot.setOrientation(PlotOrientation.HORIZONTAL); JFreeChart chart = new JFreeChart(plot); /* BufferedImage image = */ chart.createBufferedImage(300, 200, null); success = true; } catch (NullPointerException e) { e.printStackTrace(); success = false; } assertTrue(success); }
Example 10
Source File: DatasetUtilitiesTest.java From openstock with GNU General Public License v3.0 | 6 votes |
/** * Some checks for the iterateToFindRangeBounds(CategoryDataset...) * method. */ @Test public void testIterateToFindRangeBounds_StatisticalCategoryDataset() { DefaultStatisticalCategoryDataset dataset = new DefaultStatisticalCategoryDataset(); List visibleSeriesKeys = new ArrayList(); assertNull(DatasetUtilities.iterateToFindRangeBounds(dataset, visibleSeriesKeys, false)); dataset.add(1.0, 0.5, "R1", "C1"); visibleSeriesKeys.add("R1"); assertEquals(new Range(1.0, 1.0), DatasetUtilities.iterateToFindRangeBounds(dataset, visibleSeriesKeys, false)); assertEquals(new Range(0.5, 1.5), DatasetUtilities.iterateToFindRangeBounds(dataset, visibleSeriesKeys, true)); }
Example 11
Source File: StatisticalBarRendererTest.java From ECG-Viewer with GNU General Public License v2.0 | 6 votes |
/** * 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."); } }
Example 12
Source File: StatisticalBarRendererTest.java From openstock with GNU General Public License v3.0 | 6 votes |
/** * 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."); } }
Example 13
Source File: StatisticalBarRendererTest.java From openstock with GNU General Public License v3.0 | 6 votes |
/** * 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."); } }
Example 14
Source File: StatisticalBarRendererTest.java From openstock with GNU General Public License v3.0 | 6 votes |
/** * 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 testDrawWithNullMeanHorizontal() { 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()); 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."); } }
Example 15
Source File: StatisticalBarRendererTest.java From openstock with GNU General Public License v3.0 | 6 votes |
/** * 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."); } }
Example 16
Source File: StatisticalBarRendererTest.java From openstock with GNU General Public License v3.0 | 6 votes |
/** * 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."); } }
Example 17
Source File: StatisticalLineAndShapeRendererTest.java From ECG-Viewer with GNU General Public License v2.0 | 5 votes |
/** * Some checks for the findRangeBounds() method. */ @Test public void testFindRangeBounds() { StatisticalLineAndShapeRenderer r = new StatisticalLineAndShapeRenderer(); assertNull(r.findRangeBounds(null)); // an empty dataset should return a null range DefaultStatisticalCategoryDataset dataset = new DefaultStatisticalCategoryDataset(); assertNull(r.findRangeBounds(dataset)); dataset.add(1.0, 0.5, "R1", "C1"); assertEquals(new Range(0.5, 1.5), r.findRangeBounds(dataset)); dataset.add(-2.0, 0.2, "R1", "C2"); assertEquals(new Range(-2.2, 1.5), r.findRangeBounds(dataset)); dataset.add(null, null, "R1", "C3"); assertEquals(new Range(-2.2, 1.5), r.findRangeBounds(dataset)); dataset.add(5.0, 1.0, "R2", "C3"); assertEquals(new Range(-2.2, 6.0), r.findRangeBounds(dataset)); // check that the series visible flag is observed r.setSeriesVisible(1, Boolean.FALSE); assertEquals(new Range(-2.2, 1.5), r.findRangeBounds(dataset)); }
Example 18
Source File: DefaultStatisticalCategoryDatasetTests.java From astor with GNU General Public License v2.0 | 5 votes |
/** * Some checks for the getRangeBounds() method. */ public void testGetRangeBounds() { DefaultStatisticalCategoryDataset d = new DefaultStatisticalCategoryDataset(); // an empty dataset should return null for bounds assertNull(d.getRangeBounds(true)); // try a dataset with a single value d.add(4.5, 1.0, "R1", "C1"); assertEquals(new Range(4.5, 4.5), d.getRangeBounds(false)); assertEquals(new Range(3.5, 5.5), d.getRangeBounds(true)); // try a dataset with two values d.add(0.5, 2.0, "R1", "C2"); assertEquals(new Range(0.5, 4.5), d.getRangeBounds(false)); assertEquals(new Range(-1.5, 5.5), d.getRangeBounds(true)); // try a Double.NaN d.add(Double.NaN, 0.0, "R1", "C3"); assertEquals(new Range(0.5, 4.5), d.getRangeBounds(false)); assertEquals(new Range(-1.5, 5.5), d.getRangeBounds(true)); // try a Double.NEGATIVE_INFINITY d.add(Double.NEGATIVE_INFINITY, 0.0, "R1", "C3"); assertEquals(new Range(Double.NEGATIVE_INFINITY, 4.5), d.getRangeBounds(false)); assertEquals(new Range(Double.NEGATIVE_INFINITY, 5.5), d.getRangeBounds(true)); // try a Double.POSITIVE_INFINITY d.add(Double.POSITIVE_INFINITY, 0.0, "R1", "C3"); assertEquals(new Range(0.5, Double.POSITIVE_INFINITY), d.getRangeBounds(false)); assertEquals(new Range(-1.5, Double.POSITIVE_INFINITY), d.getRangeBounds(true)); }
Example 19
Source File: DefaultStatisticalCategoryDatasetTests.java From astor with GNU General Public License v2.0 | 5 votes |
/** * Some checks for the add() method. */ public void testAdd() { DefaultStatisticalCategoryDataset d1 = new DefaultStatisticalCategoryDataset(); d1.add(1.0, 2.0, "R1", "C1"); assertEquals(1.0, d1.getValue("R1", "C1").doubleValue(), EPSILON); assertEquals(2.0, d1.getStdDevValue("R1", "C1").doubleValue(), EPSILON); // overwrite the value d1.add(10.0, 20.0, "R1", "C1"); assertEquals(10.0, d1.getValue("R1", "C1").doubleValue(), EPSILON); assertEquals(20.0, d1.getStdDevValue("R1", "C1").doubleValue(), EPSILON); }
Example 20
Source File: StatisticalLineAndShapeRendererTest.java From openstock with GNU General Public License v3.0 | 5 votes |
/** * Some checks for the findRangeBounds() method. */ @Test public void testFindRangeBounds() { StatisticalLineAndShapeRenderer r = new StatisticalLineAndShapeRenderer(); assertNull(r.findRangeBounds(null)); // an empty dataset should return a null range DefaultStatisticalCategoryDataset dataset = new DefaultStatisticalCategoryDataset(); assertNull(r.findRangeBounds(dataset)); dataset.add(1.0, 0.5, "R1", "C1"); assertEquals(new Range(0.5, 1.5), r.findRangeBounds(dataset)); dataset.add(-2.0, 0.2, "R1", "C2"); assertEquals(new Range(-2.2, 1.5), r.findRangeBounds(dataset)); dataset.add(null, null, "R1", "C3"); assertEquals(new Range(-2.2, 1.5), r.findRangeBounds(dataset)); dataset.add(5.0, 1.0, "R2", "C3"); assertEquals(new Range(-2.2, 6.0), r.findRangeBounds(dataset)); // check that the series visible flag is observed r.setSeriesVisible(1, Boolean.FALSE); assertEquals(new Range(-2.2, 1.5), r.findRangeBounds(dataset)); }