/** * Creates a new pie dataset based on the supplied dataset, but modified * by aggregating all the low value items (those whose value is lower * than the {@code percentThreshold}) into a single item with the * key "Other". * * @param source the source dataset ({@code null} not permitted). * @param key a new key for the aggregated items ({@code null} not * permitted). * @param minimumPercent the percent threshold. * * @return The pie dataset with (possibly) aggregated items. */ public static PieDataset createConsolidatedPieDataset(PieDataset source, Comparable key, double minimumPercent) { return DatasetUtils.createConsolidatedPieDataset(source, key, minimumPercent, 2); }
/** * Creates a pie dataset from a table dataset by taking all the values * for a single column. * * @param dataset the dataset ({@code null} not permitted). * @param columnKey the column key. * * @return A pie dataset. */ public static PieDataset createPieDatasetForColumn(CategoryDataset dataset, Comparable columnKey) { int column = dataset.getColumnIndex(columnKey); return createPieDatasetForColumn(dataset, column); }
/** * Creates a pie dataset from a table dataset by taking all the values * for a single row. * * @param dataset the dataset ({@code null} not permitted). * @param rowKey the row key. * * @return A pie dataset. */ public static PieDataset createPieDatasetForRow(CategoryDataset dataset, Comparable rowKey) { int row = dataset.getRowIndex(rowKey); return createPieDatasetForRow(dataset, row); }
/** * Returns the range of values in the range for the dataset. * * @param dataset the dataset ({@code null} not permitted). * * @return The range (possibly {@code null}). */ public static Range findRangeBounds(CategoryDataset dataset) { return findRangeBounds(dataset, true); }
/** * Returns the minimum and maximum values for the dataset's range, * assuming that the series are stacked. * * @param dataset the dataset ({@code null} not permitted). * * @return The range ([0.0, 0.0] if the dataset contains no values). */ public static Range findStackedRangeBounds(TableXYDataset dataset) { return findStackedRangeBounds(dataset, 0.0); }
/** * Returns the range of values in the domain (x-values) of a dataset. * * @param dataset the dataset ({@code null} not permitted). * * @return The range of values (possibly {@code null}). */ public static Range findDomainBounds(XYDataset dataset) { return findDomainBounds(dataset, true); }
DatasetUtils.findDomainBounds(d)); DatasetUtils.findRangeBounds(d));
if (DatasetUtils.isEmptyOrNull(getDataset())) { drawNoDataMessage(g2, plotArea); g2.setClip(savedClip); getForegroundAlpha())); double totalValue = DatasetUtils.calculatePieDatasetTotal(dataset); double runningTotal = 0; if (depth < 0) {
if (DatasetUtils.isEmptyOrNull(this.dataset)) { drawNoDataMessage(g2, area); return; this.dataExtractOrder, pieIndex); if (this.limit > 0.0) { piedataset = DatasetUtils.createConsolidatedPieDataset( dd, this.aggregatedItemsKey, this.limit);
double total = DatasetUtils.calculatePieDatasetTotal(dataset); result[0] = key.toString(); Number value = dataset.getValue(key);
/** * Returns the interpolated value of y that corresponds to the specified * x-value in the given series. If the x-value falls outside the range of * x-values for the dataset, this method returns {@code Double.NaN}. * * @param dataset the dataset ({@code null} not permitted). * @param series the series index. * @param x the x-value. * * @return The y value. * * @since 1.0.16 */ public static double findYValue(XYDataset dataset, int series, double x) { // delegate null check on dataset int[] indices = findItemIndicesForX(dataset, series, x); if (indices[0] == -1) { return Double.NaN; } if (indices[0] == indices[1]) { return dataset.getYValue(series, indices[0]); } double x0 = dataset.getXValue(series, indices[0]); double x1 = dataset.getXValue(series, indices[1]); double y0 = dataset.getYValue(series, indices[0]); double y1 = dataset.getYValue(series, indices[1]); return y0 + (y1 - y0) * (x - x0) / (x1 - x0); }
total = DatasetUtils.calculateStackTotal( (TableXYDataset) dataset, item); value = value / total;
Number maxNumber = DatasetUtils.findMaximumRangeValue(dataset); NumberAxis rangeAxis = (NumberAxis) jNextChart.getXYPlot().getRangeAxis();
/** * Returns the range of values in the range for the dataset. This method * is the partner for the {@link #findDomainBounds(XYDataset)} method. * * @param dataset the dataset ({@code null} not permitted). * * @return The range (possibly {@code null}). */ public static Range findRangeBounds(XYDataset dataset) { return findRangeBounds(dataset, true); }
/** * Returns the minimum and maximum values for the dataset's range * (y-values), assuming that the series in one category are stacked. * * @param dataset the dataset ({@code null} not permitted). * * @return The range ({@code null} if the dataset contains no values). */ public static Range findStackedRangeBounds(CategoryDataset dataset) { return findStackedRangeBounds(dataset, 0.0); }
/** * Returns the lower and upper bounds (range) of the x-values in the * specified dataset. * * @param dataset the dataset ({@code null} permitted). * @param includeInterval include the interval (if any) for the dataset? * * @return The range ({@code null} if the dataset is {@code null} * or empty). * * @since 1.0.13 */ protected Range findDomainBounds(XYDataset dataset, boolean includeInterval) { if (dataset == null) { return null; } if (getDataBoundsIncludesVisibleSeriesOnly()) { List visibleSeriesKeys = new ArrayList(); int seriesCount = dataset.getSeriesCount(); for (int s = 0; s < seriesCount; s++) { if (isSeriesVisible(s)) { visibleSeriesKeys.add(dataset.getSeriesKey(s)); } } return DatasetUtils.findDomainBounds(dataset, visibleSeriesKeys, includeInterval); } return DatasetUtils.findDomainBounds(dataset, includeInterval); }
double total = DatasetUtils.calculatePieDatasetTotal(source);
/** * Returns the range of values the renderer requires to display all the * items from the specified dataset. * * @param dataset the dataset ({@code null} permitted). * * @return The range ({@code null} if the dataset is {@code null} * or empty). */ @Override public Range findRangeBounds(XYDataset dataset) { if (dataset != null) { return DatasetUtils.findRangeBounds(dataset, true); } else { return null; } }
/** * Returns the range of values the renderer requires to display all the * items from the specified dataset. * * @param dataset the dataset ({@code null} permitted). * * @return The range (or {@code null} if the dataset is * {@code null} or empty). */ @Override public Range findRangeBounds(CategoryDataset dataset) { if (dataset == null) { return null; } Range r = DatasetUtils.findStackedRangeBounds( dataset, this.seriesToGroupMap); return r; }
/** * Returns the lower and upper bounds (range) of the x-values in the * specified dataset. * * @param dataset the dataset ({@code null} permitted). * * @return The range ({@code null} if the dataset is {@code null} * or empty). */ @Override public Range findDomainBounds(XYDataset dataset) { if (dataset == null) { return null; } Range r = DatasetUtils.findDomainBounds(dataset, false); if (r == null) { return null; } double offset = 0; // TODO getSeriesShape(n).getBounds().width / 2; return new Range(r.getLowerBound() + offset, r.getUpperBound() + offset); }