X
- type of X valuesY
- type of Y valuespublic final class DefaultDataReducer<X extends Number,Y extends Number> extends Object implements DataReducer<X,Y>
DataReducer
implementation based on a modified version of
Ramer-Douglas-Peucker
algorithm.
Compared to the original algorithm that removes points that don't introduce error bigger than given tolerance, this implementation takes as argument the desired number of points, removing from the curve the points in the order of error size introduced i.e. points whose removal introduces smallest error are removed first. The algorithm stops once the curve has the desired number of points.
Constructor and Description |
---|
DefaultDataReducer() |
Modifier and Type | Method and Description |
---|---|
List<XYChart.Data<X,Y>> |
reduce(ChartData<X,Y> data,
Range<Double> dataRange,
int maxPointsCount)
Reduces the number of data points to be equal or less than specified
maxPointsCount . |
public List<XYChart.Data<X,Y>> reduce(ChartData<X,Y> data, Range<Double> dataRange, int maxPointsCount)
DataReducer
maxPointsCount
.reduce
in interface DataReducer<X extends Number,Y extends Number>
data
- data to be reduceddataRange
- range of data (lowerBound and upperBound) from which given data should be reducedmaxPointsCount
- the maximum number of points that the reduced list should containmaxPointsCount
elementsCopyright © 2019 CERN. All rights reserved.