Java Code Examples for org.jfree.data.general.DatasetUtilities#findCumulativeRangeBounds()

The following examples show how to use org.jfree.data.general.DatasetUtilities#findCumulativeRangeBounds() . 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: DatasetUtilitiesTests.java    From astor with GNU General Public License v2.0 6 votes vote down vote up
/**
 * A further test for the cumulative range calculation.
 */
public void testCumulativeRange2() {
    DefaultCategoryDataset dataset = new DefaultCategoryDataset();
    dataset.addValue(-21.4, "Series 1", "Start Value");
    dataset.addValue(11.57, "Series 1", "Delta 1");
    dataset.addValue(3.51, "Series 1", "Delta 2");
    dataset.addValue(-12.36, "Series 1", "Delta 3");
    dataset.addValue(3.39, "Series 1", "Delta 4");
    dataset.addValue(38.68, "Series 1", "Delta 5");
    dataset.addValue(-43.31, "Series 1", "Delta 6");
    dataset.addValue(-29.59, "Series 1", "Delta 7");
    dataset.addValue(35.30, "Series 1", "Delta 8");
    dataset.addValue(5.0, "Series 1", "Delta 9");
    Range range = DatasetUtilities.findCumulativeRangeBounds(dataset);
    assertEquals(-49.51, range.getLowerBound(), 0.00000001);
    assertEquals(23.39, range.getUpperBound(), 0.00000001);
}
 
Example 2
Source File: DatasetUtilitiesTests.java    From astor with GNU General Public License v2.0 6 votes vote down vote up
/**
 * A further test for the cumulative range calculation.
 */
public void testCumulativeRange2() {
    DefaultCategoryDataset dataset = new DefaultCategoryDataset();
    dataset.addValue(-21.4, "Series 1", "Start Value");
    dataset.addValue(11.57, "Series 1", "Delta 1");
    dataset.addValue(3.51, "Series 1", "Delta 2");
    dataset.addValue(-12.36, "Series 1", "Delta 3");
    dataset.addValue(3.39, "Series 1", "Delta 4");
    dataset.addValue(38.68, "Series 1", "Delta 5");
    dataset.addValue(-43.31, "Series 1", "Delta 6");
    dataset.addValue(-29.59, "Series 1", "Delta 7");
    dataset.addValue(35.30, "Series 1", "Delta 8");
    dataset.addValue(5.0, "Series 1", "Delta 9");
    Range range = DatasetUtilities.findCumulativeRangeBounds(dataset);
    assertEquals(-49.51, range.getLowerBound(), 0.00000001);
    assertEquals(23.39, range.getUpperBound(), 0.00000001);
}
 
Example 3
Source File: DatasetUtilitiesTests.java    From astor with GNU General Public License v2.0 5 votes vote down vote up
/**
 * A simple test for the cumulative range calculation.  The sequence of
 * "cumulative" values are considered to be { 0.0, 10.0, 25.0, 18.0 } so
 * the range should be 0.0 -> 25.0.
 */
public void testCumulativeRange1() {
    DefaultCategoryDataset dataset = new DefaultCategoryDataset();
    dataset.addValue(10.0, "Series 1", "Start");
    dataset.addValue(15.0, "Series 1", "Delta 1");
    dataset.addValue(-7.0, "Series 1", "Delta 2");
    Range range = DatasetUtilities.findCumulativeRangeBounds(dataset);
    assertEquals(0.0, range.getLowerBound(), 0.00000001);
    assertEquals(25.0, range.getUpperBound(), 0.00000001);
}
 
Example 4
Source File: DatasetUtilitiesTests.java    From astor with GNU General Public License v2.0 5 votes vote down vote up
/**
 * A further test for the cumulative range calculation.
 */
public void testCumulativeRange3() {
    DefaultCategoryDataset dataset = new DefaultCategoryDataset();
    dataset.addValue(15.76, "Product 1", "Labour");
    dataset.addValue(8.66, "Product 1", "Administration");
    dataset.addValue(4.71, "Product 1", "Marketing");
    dataset.addValue(3.51, "Product 1", "Distribution");
    dataset.addValue(32.64, "Product 1", "Total Expense");
    Range range = DatasetUtilities.findCumulativeRangeBounds(dataset);
    assertEquals(0.0, range.getLowerBound(), EPSILON);
    assertEquals(65.28, range.getUpperBound(), EPSILON);
}
 
Example 5
Source File: DatasetUtilitiesTests.java    From astor with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Check that the findCumulativeRangeBounds() method ignores Double.NaN
 * values.
 */
public void testCumulativeRange_NaN() {
    DefaultCategoryDataset dataset = new DefaultCategoryDataset();
    dataset.addValue(10.0, "Series 1", "Start");
    dataset.addValue(15.0, "Series 1", "Delta 1");
    dataset.addValue(Double.NaN, "Series 1", "Delta 2");
    Range range = DatasetUtilities.findCumulativeRangeBounds(dataset);
    assertEquals(0.0, range.getLowerBound(), EPSILON);
    assertEquals(25.0, range.getUpperBound(), EPSILON);
}
 
Example 6
Source File: DatasetUtilitiesTests.java    From astor with GNU General Public License v2.0 5 votes vote down vote up
/**
 * A simple test for the cumulative range calculation.  The sequence of 
 * "cumulative" values are considered to be { 0.0, 10.0, 25.0, 18.0 } so 
 * the range should be 0.0 -> 25.0.
 */
public void testCumulativeRange1() {
    DefaultCategoryDataset dataset = new DefaultCategoryDataset();
    dataset.addValue(10.0, "Series 1", "Start");
    dataset.addValue(15.0, "Series 1", "Delta 1");
    dataset.addValue(-7.0, "Series 1", "Delta 2");
    Range range = DatasetUtilities.findCumulativeRangeBounds(dataset);
    assertEquals(0.0, range.getLowerBound(), 0.00000001);
    assertEquals(25.0, range.getUpperBound(), 0.00000001);
}
 
Example 7
Source File: WaterfallBarRenderer.java    From opensim-gui with Apache License 2.0 2 votes vote down vote up
/**
 * Returns the range of values the renderer requires to display all the 
 * items from the specified dataset.
 * 
 * @param dataset  the dataset (<code>null</code> not permitted).
 * 
 * @return The range (or <code>null</code> if the dataset is empty).
 */
public Range findRangeBounds(CategoryDataset dataset) {
    return DatasetUtilities.findCumulativeRangeBounds(dataset);   
}