-
- All Implemented Interfaces:
-
com.androidplot.Series
,com.androidplot.xy.FastXYSeries
,com.androidplot.xy.OrderedXYSeries
,com.androidplot.xy.XYSeries
public class SampledXYSeries implements FastXYSeries, OrderedXYSeries
An implementation of FastXYSeries that samples its self into multiple levels to achieve faster rendering / zoom behavior. By default, uses LTTBSampler as it's sampling algorithm. Note that this algorithm does not yet support null values. Sampling behavior is controlled by two values: Ratio: A value greater than 1; controls the sampling ratio of each successive series. For example, a step of 2 would mean that each successive series contains 2x fewer points than the previous. Threshold: A value < the original series size; controls the lower limit at which point sampling should stop. For example, sampling a series with size 1000 given a ratio of 2 and a threshold of 100, three sampled resolutions will be generated: 500 - 2x sampling 250 - 4x sampling 125 - 8x sampling
-
-
Field Summary
Fields Modifier and Type Field Description private int
threshold
private Sampler
algorithm
private RectRegion
bounds
private final OrderedXYSeries.XOrder
xOrder
private float
ratio
-
Constructor Summary
Constructors Constructor Description SampledXYSeries(XYSeries rawData, OrderedXYSeries.XOrder xOrder, float ratio, int threshold)
SampledXYSeries(XYSeries rawData, float ratio, int threshold)
Generate a SampledXYSeries from the input series.
-
Method Summary
Modifier and Type Method Description int
getThreshold()
void
setThreshold(int threshold)
Sampler
getAlgorithm()
void
setAlgorithm(Sampler algorithm)
RectRegion
getBounds()
void
setBounds(RectRegion bounds)
OrderedXYSeries.XOrder
getXOrder()
The order of XVals as they appear in this series. float
getRatio()
void
setRatio(float ratio)
void
resample()
void
setZoomFactor(double factor)
Set zoom factor; 2.5 = 2.5x zoom, 10.0 = 10x zoom etc. double
getMaxZoomFactor()
String
getTitle()
int
size()
Number
getX(int index)
Returns the x-value for an index within a series. Number
getY(int index)
Returns the y-value for an index within a series. RectRegion
minMax()
TIP: You can use union duringto keep a running tally of min/max values when iterating. -
-
Constructor Detail
-
SampledXYSeries
SampledXYSeries(XYSeries rawData, OrderedXYSeries.XOrder xOrder, float ratio, int threshold)
- Parameters:
xOrder
- If your data is in ascending or descending order, specifying it here speed upoptimize render times.ratio
- The ratio used to determine the size of each new sampled series.threshold
- The desired size of the smallest sample series.
-
SampledXYSeries
SampledXYSeries(XYSeries rawData, float ratio, int threshold)
Generate a SampledXYSeries from the input series.- Parameters:
rawData
- The original series to be downsampledratio
- The ratio used to determine the size of each new sampled series.threshold
- The desired size of the smallest sample series.
-
-
Method Detail
-
getThreshold
int getThreshold()
-
setThreshold
void setThreshold(int threshold)
-
getAlgorithm
Sampler getAlgorithm()
-
setAlgorithm
void setAlgorithm(Sampler algorithm)
-
getBounds
RectRegion getBounds()
-
setBounds
void setBounds(RectRegion bounds)
-
getXOrder
OrderedXYSeries.XOrder getXOrder()
The order of XVals as they appear in this series.
-
getRatio
float getRatio()
-
setRatio
void setRatio(float ratio)
-
resample
void resample()
-
setZoomFactor
void setZoomFactor(double factor)
Set zoom factor; 2.5 = 2.5x zoom, 10.0 = 10x zoom etc. This method will set the zoom levelto the closest available factor to the specified factor; a specified factor of 4.5x may resultin an actual factor of 4x.
-
getMaxZoomFactor
double getMaxZoomFactor()
-
size
int size()
-
getX
Number getX(int index)
Returns the x-value for an index within a series.
- Parameters:
index
- the index index (in the range0
tosize()-1
).
-
getY
Number getY(int index)
Returns the y-value for an index within a series.
- Parameters:
index
- the index index (in the range0
tosize()-1
).
-
minMax
RectRegion minMax()
TIP: You can use union duringto keep a running tally of min/max values when iterating.
-
-
-
-