Class SampledXYSeries
-
- 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 public intthresholdpublic Sampleralgorithmpublic RectRegionboundspublic final OrderedXYSeries.XOrderxOrderpublic floatratio
-
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 intgetThreshold()voidsetThreshold(int threshold)SamplergetAlgorithm()voidsetAlgorithm(@NonNull() Sampler algorithm)RectRegiongetBounds()voidsetBounds(@Nullable() RectRegion bounds)OrderedXYSeries.XOrdergetXOrder()The order of XVals as they appear in this series. floatgetRatio()voidsetRatio(float ratio)voidresample()voidsetZoomFactor(double factor)Set zoom factor; 2.5 = 2.5x zoom, 10.0 = 10x zoom etc. doublegetMaxZoomFactor()StringgetTitle()intsize()NumbergetX(int index)Returns the x-value for an index within a series. NumbergetY(int index)Returns the y-value for an index within a series. RectRegionminMax()TIP: You can use union during to 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 up optimize 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
@NonNull() Sampler getAlgorithm()
-
setAlgorithm
void setAlgorithm(@NonNull() Sampler algorithm)
-
getBounds
@Nullable() RectRegion getBounds()
- Returns:
The min/max bounds of the raw data. Never null after construction unless explicitly set to null via setBounds.
-
setBounds
void setBounds(@Nullable() RectRegion bounds)
-
getXOrder
@NonNull() 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 level to the closest available factor to the specified factor; a specified factor of 4.5x may result in an actual factor of 4x.
-
getMaxZoomFactor
double getMaxZoomFactor()
-
size
int size()
- Returns:
Number of elements in this Series.
-
getX
@Nullable() Number getX(int index)
Returns the x-value for an index within a series.
- Parameters:
index- the index index (in the range0tosize()-1).- Returns:
The x-value.
-
getY
@Nullable() Number getY(int index)
Returns the y-value for an index within a series.
- Parameters:
index- the index index (in the range0tosize()-1).- Returns:
The y-value.
-
minMax
@Nullable() RectRegion minMax()
TIP: You can use union during to keep a running tally of min/max values when iterating.
- Returns:
A RectRegion representing the min/max values that currently exist this series.
-
-
-
-