-
- 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 intthresholdprivate Sampleralgorithmprivate RectRegionboundsprivate final OrderedXYSeries.XOrderxOrderprivate 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(Sampler algorithm)RectRegiongetBounds()voidsetBounds(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 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 range0tosize()-1).
-
getY
Number getY(int index)
Returns the y-value for an index within a series.
- Parameters:
index- the index index (in the range0tosize()-1).
-
minMax
RectRegion minMax()
TIP: You can use union duringto keep a running tally of min/max values when iterating.
-
-
-
-