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

The following examples show how to use org.jfree.data.general.DatasetUtilities#findRangeBounds() . 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: XYBlockRenderer.java    From astor with GNU General Public License v2.0 6 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> permitted).
 * 
 * @return The range (<code>null</code> if the dataset is <code>null</code> 
 *         or empty).
 *         
 * @see #findDomainBounds(XYDataset)
 */
public Range findRangeBounds(XYDataset dataset) {
    if (dataset != null) {
        Range r = DatasetUtilities.findRangeBounds(dataset, false);
        if (r == null) {
            return null; 
        }
        else {
            return new Range(r.getLowerBound() + this.yOffset, 
                    r.getUpperBound() + this.blockHeight + this.yOffset);
        }
    }
    else {
        return null;
    }
}
 
Example 2
Source File: AbstractCategoryItemRenderer.java    From buffer_bci with GNU General Public License v3.0 6 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> permitted).
 * @param includeInterval  include the y-interval if the dataset has one.
 *
 * @return The range (<code>null</code> if the dataset is <code>null</code>
 *         or empty).
 *
 * @since 1.0.13
 */
protected Range findRangeBounds(CategoryDataset dataset,
        boolean includeInterval) {
    if (dataset == null) {
        return null;
    }
    if (getDataBoundsIncludesVisibleSeriesOnly()) {
        List visibleSeriesKeys = new ArrayList();
        int seriesCount = dataset.getRowCount();
        for (int s = 0; s < seriesCount; s++) {
            if (isSeriesVisible(s)) {
                visibleSeriesKeys.add(dataset.getRowKey(s));
            }
        }
        return DatasetUtilities.findRangeBounds(dataset,
                visibleSeriesKeys, includeInterval);
    }
    else {
        return DatasetUtilities.findRangeBounds(dataset, includeInterval);
    }
}
 
Example 3
Source File: Arja_000_s.java    From coming with MIT License 6 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> permitted).
 * @param includeInterval  include the y-interval if the dataset has one.
 *
 * @return The range (<code>null</code> if the dataset is <code>null</code>
 *         or empty).
 *
 * @since 1.0.13
 */
protected Range findRangeBounds(CategoryDataset dataset,
        boolean includeInterval) {
    if (dataset == null) {
        return null;
    }
    if (getDataBoundsIncludesVisibleSeriesOnly()) {
        List visibleSeriesKeys = new ArrayList();
        int seriesCount = dataset.getRowCount();
        for (int s = 0; s < seriesCount; s++) {
            if (isSeriesVisible(s)) {
                visibleSeriesKeys.add(dataset.getRowKey(s));
            }
        }
        return DatasetUtilities.findRangeBounds(dataset,
                visibleSeriesKeys, includeInterval);
    }
    else {
        return DatasetUtilities.findRangeBounds(dataset, includeInterval);
    }
}
 
Example 4
Source File: Arja_00112_s.java    From coming with MIT License 6 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> permitted).
 * @param includeInterval  include the y-interval if the dataset has one.
 *
 * @return The range (<code>null</code> if the dataset is <code>null</code>
 *         or empty).
 *
 * @since 1.0.13
 */
protected Range findRangeBounds(CategoryDataset dataset,
        boolean includeInterval) {
    if (dataset == null) {
        return null;
    }
    if (getDataBoundsIncludesVisibleSeriesOnly()) {
        List visibleSeriesKeys = new ArrayList();
        int seriesCount = dataset.getRowCount();
        for (int s = 0; s < seriesCount; s++) {
            if (isSeriesVisible(s)) {
                visibleSeriesKeys.add(dataset.getRowKey(s));
            }
        }
        return DatasetUtilities.findRangeBounds(dataset,
                visibleSeriesKeys, includeInterval);
    }
    else {
        return DatasetUtilities.findRangeBounds(dataset, includeInterval);
    }
}
 
Example 5
Source File: Chart_1_AbstractCategoryItemRenderer_s.java    From coming with MIT License 6 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> permitted).
 * @param includeInterval  include the y-interval if the dataset has one.
 *
 * @return The range (<code>null</code> if the dataset is <code>null</code>
 *         or empty).
 *
 * @since 1.0.13
 */
protected Range findRangeBounds(CategoryDataset dataset,
        boolean includeInterval) {
    if (dataset == null) {
        return null;
    }
    if (getDataBoundsIncludesVisibleSeriesOnly()) {
        List visibleSeriesKeys = new ArrayList();
        int seriesCount = dataset.getRowCount();
        for (int s = 0; s < seriesCount; s++) {
            if (isSeriesVisible(s)) {
                visibleSeriesKeys.add(dataset.getRowKey(s));
            }
        }
        return DatasetUtilities.findRangeBounds(dataset,
                visibleSeriesKeys, includeInterval);
    }
    else {
        return DatasetUtilities.findRangeBounds(dataset, includeInterval);
    }
}
 
Example 6
Source File: JGenProg2017_000_t.java    From coming with MIT License 6 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> permitted).
 * @param includeInterval  include the y-interval if the dataset has one.
 *
 * @return The range (<code>null</code> if the dataset is <code>null</code>
 *         or empty).
 *
 * @since 1.0.13
 */
protected Range findRangeBounds(CategoryDataset dataset,
        boolean includeInterval) {
    if (dataset == null) {
        return null;
    }
    if (getDataBoundsIncludesVisibleSeriesOnly()) {
        List visibleSeriesKeys = new ArrayList();
        int seriesCount = dataset.getRowCount();
        for (int s = 0; s < seriesCount; s++) {
            if (isSeriesVisible(s)) {
                visibleSeriesKeys.add(dataset.getRowKey(s));
            }
        }
        return DatasetUtilities.findRangeBounds(dataset,
                visibleSeriesKeys, includeInterval);
    }
    else {
        return DatasetUtilities.findRangeBounds(dataset, includeInterval);
    }
}
 
Example 7
Source File: XYBlockRenderer.java    From buffer_bci with GNU General Public License v3.0 6 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> permitted).
 *
 * @return The range (<code>null</code> if the dataset is <code>null</code>
 *         or empty).
 *
 * @see #findDomainBounds(XYDataset)
 */
@Override
public Range findRangeBounds(XYDataset dataset) {
    if (dataset != null) {
        Range r = DatasetUtilities.findRangeBounds(dataset, false);
        if (r == null) {
            return null;
        }
        else {
            return new Range(r.getLowerBound() + this.yOffset,
                    r.getUpperBound() + this.blockHeight + this.yOffset);
        }
    }
    else {
        return null;
    }
}
 
Example 8
Source File: ContourPlot.java    From openstock with GNU General Public License v3.0 6 votes vote down vote up
/**
 * Returns the range for an axis.
 *
 * @param axis  the axis.
 *
 * @return The range for an axis.
 */
@Override
public Range getDataRange(ValueAxis axis) {

    if (this.dataset == null) {
        return null;
    }

    Range result = null;

    if (axis == getDomainAxis()) {
        result = DatasetUtilities.findDomainBounds(this.dataset);
    }
    else if (axis == getRangeAxis()) {
        result = DatasetUtilities.findRangeBounds(this.dataset);
    }
    return result;
}
 
Example 9
Source File: JGenProg2017_00102_s.java    From coming with MIT License 6 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> permitted).
 * @param includeInterval  include the y-interval if the dataset has one.
 *
 * @return The range (<code>null</code> if the dataset is <code>null</code>
 *         or empty).
 *
 * @since 1.0.13
 */
protected Range findRangeBounds(CategoryDataset dataset,
        boolean includeInterval) {
    if (dataset == null) {
        return null;
    }
    if (getDataBoundsIncludesVisibleSeriesOnly()) {
        List visibleSeriesKeys = new ArrayList();
        int seriesCount = dataset.getRowCount();
        for (int s = 0; s < seriesCount; s++) {
            if (isSeriesVisible(s)) {
                visibleSeriesKeys.add(dataset.getRowKey(s));
            }
        }
        return DatasetUtilities.findRangeBounds(dataset,
                visibleSeriesKeys, includeInterval);
    }
    else {
        return DatasetUtilities.findRangeBounds(dataset, includeInterval);
    }
}
 
Example 10
Source File: XYBlockRenderer.java    From openstock with GNU General Public License v3.0 6 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> permitted).
 *
 * @return The range (<code>null</code> if the dataset is <code>null</code>
 *         or empty).
 *
 * @see #findDomainBounds(XYDataset)
 */
@Override
public Range findRangeBounds(XYDataset dataset) {
    if (dataset != null) {
        Range r = DatasetUtilities.findRangeBounds(dataset, false);
        if (r == null) {
            return null;
        }
        else {
            return new Range(r.getLowerBound() + this.yOffset,
                    r.getUpperBound() + this.blockHeight + this.yOffset);
        }
    }
    else {
        return null;
    }
}
 
Example 11
Source File: XYShapeRenderer.java    From buffer_bci with GNU General Public License v3.0 5 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> permitted).
 *
 * @return The range (<code>null</code> if the dataset is <code>null</code>
 *         or empty).
 */
@Override
public Range findRangeBounds(XYDataset dataset) {
    if (dataset == null) {
        return null;
    }
    Range r = DatasetUtilities.findRangeBounds(dataset, false);
    if (r == null) {
        return null;
    }
    double offset = 0; // TODO getSeriesShape(n).getBounds().height / 2;
    return new Range(r.getLowerBound() + offset, r.getUpperBound()
            + offset);
}
 
Example 12
Source File: DefaultOHLCDatasetTests.java    From astor with GNU General Public License v2.0 5 votes vote down vote up
/**
 * A small test for the data range calculated on this dataset.
 */
public void testDataRange() {
    OHLCDataItem[] data = new OHLCDataItem[3];
    data[0] = new OHLCDataItem(new Date(11L), 2.0, 4.0, 1.0, 3.0, 100.0);
    data[1] = new OHLCDataItem(new Date(22L), 4.0, 9.0, 2.0, 5.0, 120.0);
    data[2] = new OHLCDataItem(new Date(33L), 3.0, 7.0, 3.0, 6.0, 140.0);
    DefaultOHLCDataset d = new DefaultOHLCDataset("S1", data);
    Range r = DatasetUtilities.findRangeBounds(d, true);
    assertEquals(1.0, r.getLowerBound(), EPSILON);
    assertEquals(9.0, r.getUpperBound(), EPSILON);
}
 
Example 13
Source File: DefaultOHLCDatasetTest.java    From ECG-Viewer with GNU General Public License v2.0 5 votes vote down vote up
/**
 * A small test for the data range calculated on this dataset.
 */
@Test
public void testDataRange() {
    OHLCDataItem[] data = new OHLCDataItem[3];
    data[0] = new OHLCDataItem(new Date(11L), 2.0, 4.0, 1.0, 3.0, 100.0);
    data[1] = new OHLCDataItem(new Date(22L), 4.0, 9.0, 2.0, 5.0, 120.0);
    data[2] = new OHLCDataItem(new Date(33L), 3.0, 7.0, 3.0, 6.0, 140.0);
    DefaultOHLCDataset d = new DefaultOHLCDataset("S1", data);
    Range r = DatasetUtilities.findRangeBounds(d, true);
    assertEquals(1.0, r.getLowerBound(), EPSILON);
    assertEquals(9.0, r.getUpperBound(), EPSILON);
}
 
Example 14
Source File: HighLowRenderer.java    From buffer_bci with GNU General Public License v3.0 5 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> permitted).
 *
 * @return The range (<code>null</code> if the dataset is <code>null</code>
 *         or empty).
 */
@Override
public Range findRangeBounds(XYDataset dataset) {
    if (dataset != null) {
        return DatasetUtilities.findRangeBounds(dataset, true);
    }
    else {
        return null;
    }
}
 
Example 15
Source File: XYShapeRenderer.java    From openstock with GNU General Public License v3.0 5 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> permitted).
 *
 * @return The range (<code>null</code> if the dataset is <code>null</code>
 *         or empty).
 */
@Override
public Range findRangeBounds(XYDataset dataset) {
    if (dataset == null) {
        return null;
    }
    Range r = DatasetUtilities.findRangeBounds(dataset, false);
    if (r == null) {
        return null;
    }
    double offset = 0; // TODO getSeriesShape(n).getBounds().height / 2;
    return new Range(r.getLowerBound() + offset, r.getUpperBound()
            + offset);
}
 
Example 16
Source File: BarRenderer.java    From astor with GNU General Public License v2.0 3 votes vote down vote up
/**
 * Returns the range of values the renderer requires to display all the 
 * items from the specified dataset.  This takes into account the range
 * of values in the dataset, plus the flag that determines whether or not
 * the base value for the bars should be included in the range.
 * 
 * @param dataset  the dataset (<code>null</code> permitted).
 * 
 * @return The range (or <code>null</code> if the dataset is 
 *         <code>null</code> or empty).
 */
public Range findRangeBounds(CategoryDataset dataset) {
    Range result = DatasetUtilities.findRangeBounds(dataset);
    if (result != null) {
        if (this.includeBaseInRange) {
            result = Range.expandToInclude(result, this.base);
        }
    }
    return result;
}
 
Example 17
Source File: XYErrorRenderer.java    From opensim-gui with Apache License 2.0 3 votes vote down vote up
/**
 * Returns the range required by this renderer to display all the range
 * values in the specified dataset.
 * 
 * @param dataset  the dataset (<code>null</code> permitted).
 * 
 * @return The range, or <code>null</code> if the dataset is 
 *     <code>null</code>.
 */
public Range findRangeBounds(XYDataset dataset) {
    if (dataset != null) {
        return DatasetUtilities.findRangeBounds(dataset, true);
    }
    else {
        return null;
    }
}
 
Example 18
Source File: DeviationRenderer.java    From astor with GNU General Public License v2.0 3 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> permitted).
 *
 * @return The range (<code>null</code> if the dataset is <code>null</code>
 *         or empty).
 */
public Range findRangeBounds(XYDataset dataset) {
    if (dataset != null) {
        return DatasetUtilities.findRangeBounds(dataset, true);
    }
    else {
        return null;
    }
}
 
Example 19
Source File: AbstractXYItemRenderer.java    From opensim-gui with Apache License 2.0 3 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> permitted).
 * 
 * @return The range (<code>null</code> if the dataset is <code>null</code> 
 *         or empty).
 */
public Range findRangeBounds(XYDataset dataset) {
    if (dataset != null) {
        return DatasetUtilities.findRangeBounds(dataset, false);
    }
    else {
        return null;
    }
}
 
Example 20
Source File: XYErrorRenderer.java    From astor with GNU General Public License v2.0 3 votes vote down vote up
/**
 * Returns the range required by this renderer to display all the range
 * values in the specified dataset.
 * 
 * @param dataset  the dataset (<code>null</code> permitted).
 * 
 * @return The range, or <code>null</code> if the dataset is 
 *     <code>null</code>.
 */
public Range findRangeBounds(XYDataset dataset) {
    if (dataset != null) {
        return DatasetUtilities.findRangeBounds(dataset, true);
    }
    else {
        return null;
    }
}