public class SampledXYSeries extends java.lang.Object implements FastXYSeries, OrderedXYSeries
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 samplingOrderedXYSeries.XOrder
Constructor and Description |
---|
SampledXYSeries(XYSeries rawData,
float ratio,
int threshold)
Generate a SampledXYSeries from the input series.
|
SampledXYSeries(XYSeries rawData,
OrderedXYSeries.XOrder xOrder,
float ratio,
int threshold) |
Modifier and Type | Method and Description |
---|---|
Sampler |
getAlgorithm() |
RectRegion |
getBounds() |
double |
getMaxZoomFactor() |
float |
getRatio() |
int |
getThreshold() |
java.lang.String |
getTitle() |
java.lang.Number |
getX(int index)
Returns the x-value for an index within a series.
|
OrderedXYSeries.XOrder |
getXOrder()
The order of XVals as they appear in this series.
|
java.lang.Number |
getY(int index)
Returns the y-value for an index within a series.
|
protected static int |
getZoomIndex(double zoomFactor,
double ratio) |
protected java.util.List<EditableXYSeries> |
getZoomLevels() |
RectRegion |
minMax()
TIP: You can use
RectRegion.union(Number, Number) during
to keep a running tally of min/max values when iterating. |
void |
resample() |
void |
setAlgorithm(Sampler algorithm) |
void |
setBounds(RectRegion bounds) |
void |
setRatio(float ratio) |
void |
setThreshold(int threshold) |
void |
setZoomFactor(double factor)
Set zoom factor; 2.5 = 2.5x zoom, 10.0 = 10x zoom etc.
|
int |
size() |
public SampledXYSeries(XYSeries rawData, OrderedXYSeries.XOrder xOrder, float ratio, int threshold)
rawData
- 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. Must be > 1.
downsampled series until threshold is reached.threshold
- The desired size of the smallest sample series. Must be < rawData.size.public SampledXYSeries(XYSeries rawData, float ratio, int threshold)
rawData
- The original series to be downsampledratio
- The ratio used to determine the size of each new sampled series. Must be > 1.
downsampled series until threshold is reached.threshold
- The desired size of the smallest sample series. Must be < rawData.size.public void resample()
protected java.util.List<EditableXYSeries> getZoomLevels()
public void setZoomFactor(double factor)
factor
- protected static int getZoomIndex(double zoomFactor, double ratio)
public double getMaxZoomFactor()
public Sampler getAlgorithm()
public void setAlgorithm(Sampler algorithm)
public java.lang.String getTitle()
public int size()
public java.lang.Number getX(int index)
XYSeries
public java.lang.Number getY(int index)
XYSeries
public int getThreshold()
public void setThreshold(int threshold)
public RectRegion getBounds()
public void setBounds(RectRegion bounds)
public RectRegion minMax()
FastXYSeries
RectRegion.union(Number, Number)
during
to keep a running tally of min/max values when iterating.minMax
in interface FastXYSeries
RectRegion
representing the min/max values that currently exist this series.public OrderedXYSeries.XOrder getXOrder()
OrderedXYSeries
getXOrder
in interface OrderedXYSeries
public float getRatio()
public void setRatio(float ratio)