List of usage examples for org.jfree.data DomainInfo getDomainLowerBound
public double getDomainLowerBound(boolean includeInterval);
From source file:org.jfree.data.general.DatasetUtils.java
/** * Finds the minimum domain (or X) value for the specified dataset. This * is easy if the dataset implements the {@link DomainInfo} interface (a * good idea if there is an efficient way to determine the minimum value). * Otherwise, it involves iterating over the entire data-set. * <p>/*from w ww . j a v a 2 s. c o m*/ * Returns {@code null} if all the data values in the dataset are * {@code null}. * * @param dataset the dataset ({@code null} not permitted). * * @return The minimum value (possibly {@code null}). */ public static Number findMinimumDomainValue(XYDataset dataset) { Args.nullNotPermitted(dataset, "dataset"); Number result; // if the dataset implements DomainInfo, life is easy if (dataset instanceof DomainInfo) { DomainInfo info = (DomainInfo) dataset; return new Double(info.getDomainLowerBound(true)); } else { double minimum = Double.POSITIVE_INFINITY; int seriesCount = dataset.getSeriesCount(); for (int series = 0; series < seriesCount; series++) { int itemCount = dataset.getItemCount(series); for (int item = 0; item < itemCount; item++) { double value; if (dataset instanceof IntervalXYDataset) { IntervalXYDataset intervalXYData = (IntervalXYDataset) dataset; value = intervalXYData.getStartXValue(series, item); } else { value = dataset.getXValue(series, item); } if (!Double.isNaN(value)) { minimum = Math.min(minimum, value); } } } if (minimum == Double.POSITIVE_INFINITY) { result = null; } else { result = new Double(minimum); } } return result; }
From source file:org.jfree.data.general.DatasetUtilities.java
/** * Finds the minimum domain (or X) value for the specified dataset. This * is easy if the dataset implements the {@link DomainInfo} interface (a * good idea if there is an efficient way to determine the minimum value). * Otherwise, it involves iterating over the entire data-set. * <p>/*from w ww . j av a 2 s . co m*/ * Returns <code>null</code> if all the data values in the dataset are * <code>null</code>. * * @param dataset the dataset (<code>null</code> not permitted). * * @return The minimum value (possibly <code>null</code>). */ public static Number findMinimumDomainValue(XYDataset dataset) { ParamChecks.nullNotPermitted(dataset, "dataset"); Number result; // if the dataset implements DomainInfo, life is easy if (dataset instanceof DomainInfo) { DomainInfo info = (DomainInfo) dataset; return new Double(info.getDomainLowerBound(true)); } else { double minimum = Double.POSITIVE_INFINITY; int seriesCount = dataset.getSeriesCount(); for (int series = 0; series < seriesCount; series++) { int itemCount = dataset.getItemCount(series); for (int item = 0; item < itemCount; item++) { double value; if (dataset instanceof IntervalXYDataset) { IntervalXYDataset intervalXYData = (IntervalXYDataset) dataset; value = intervalXYData.getStartXValue(series, item); } else { value = dataset.getXValue(series, item); } if (!Double.isNaN(value)) { minimum = Math.min(minimum, value); } } } if (minimum == Double.POSITIVE_INFINITY) { result = null; } else { result = new Double(minimum); } } return result; }