Class SimpleXYSeries
-
- All Implemented Interfaces:
-
com.androidplot.PlotListener,com.androidplot.Series,com.androidplot.xy.EditableXYSeries,com.androidplot.xy.OrderedXYSeries,com.androidplot.xy.XYSeries
public class SimpleXYSeries implements EditableXYSeries, OrderedXYSeries, PlotListener
A convenience class used to create instances of XYPlot generated from Lists of Numbers.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description public enumSimpleXYSeries.ArrayFormat
-
Field Summary
Fields Modifier and Type Field Description public volatile Stringtitlepublic OrderedXYSeries.XOrderxOrder
-
Constructor Summary
Constructors Constructor Description SimpleXYSeries(String title)SimpleXYSeries(SimpleXYSeries.ArrayFormat format, String title, Array<Number> model)SimpleXYSeries(List<out Number> model, SimpleXYSeries.ArrayFormat format, String title)Generates an XYSeries instance from the List of numbers passed in. SimpleXYSeries(List<out Number> xVals, List<out Number> yVals, String title)
-
Method Summary
Modifier and Type Method Description StringgetTitle()voidsetTitle(@Nullable() String title)OrderedXYSeries.XOrdergetXOrder()Retrieve the current x-ordering specified for this series. voidsetXOrder(@NonNull() OrderedXYSeries.XOrder xOrder)If XVals are in strict ascending order, use this method to set ASCENDING to provide an optimization hint to the renderer. voidonBeforeDraw(@NonNull() Plot source, @NonNull() Canvas canvas)Fired immediately before the Plot "source" is drawn onto canvas. voidonAfterDraw(@NonNull() Plot source, @NonNull() Canvas canvas)Fired immediately after the Plot "source" is drawn onto canvas. voiduseImplicitXVals()Use index value as xVal, instead of explicit, user provided xVals. voidsetModel(@Nullable() List<out Number> model, @NonNull() SimpleXYSeries.ArrayFormat format)Use the provided list of Numbers as yVals and their corresponding indexes as xVals. voidsetX(@Nullable() Number value, int index)Sets individual x value based on index voidsetY(@Nullable() Number value, int index)Sets individual y value based on index voidresize(int size)Resize to accommodate the specified number of x/y pairs. voidsetXY(@Nullable() Number xVal, @Nullable() Number yVal, int index)Sets xy values based on index. voidaddFirst(@Nullable() Number x, @Nullable() Number y)XYCoordsremoveFirst()voidaddLast(@Nullable() Number x, @Nullable() Number y)XYCoordsremoveLast()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. LinkedList<Number>getxVals()LinkedList<Number>getyVals()voidclear()Remove all values from the series -
-
Constructor Detail
-
SimpleXYSeries
SimpleXYSeries(String title)
-
SimpleXYSeries
SimpleXYSeries(SimpleXYSeries.ArrayFormat format, String title, Array<Number> model)
-
SimpleXYSeries
SimpleXYSeries(List<out Number> model, SimpleXYSeries.ArrayFormat format, String title)
Generates an XYSeries instance from the List of numbers passed in. This is a convenience class and should only be used for static data models; it is not suitable for representing dynamically changing data.
- Parameters:
model- A List of Number elements comprising the data model.format- Format of the model.title- Title of the series
-
-
Method Detail
-
getXOrder
@NonNull() OrderedXYSeries.XOrder getXOrder()
Retrieve the current x-ordering specified for this series. Default is NONE.
-
setXOrder
void setXOrder(@NonNull() OrderedXYSeries.XOrder xOrder)
If XVals are in strict ascending order, use this method to set ASCENDING to provide an optimization hint to the renderer.
-
onBeforeDraw
void onBeforeDraw(@NonNull() Plot source, @NonNull() Canvas canvas)
Fired immediately before the Plot "source" is drawn onto canvas. Commonly used by implementing Series instances to activate a read lock on it's self in preparation for the Plot's imminent reading of that series.
-
onAfterDraw
void onAfterDraw(@NonNull() Plot source, @NonNull() Canvas canvas)
Fired immediately after the Plot "source" is drawn onto canvas. Just as onBeforeDraw(...) is commonly used by Series implementations to activate a read lock, this method is commonly used to release that same lock.
-
useImplicitXVals
void useImplicitXVals()
Use index value as xVal, instead of explicit, user provided xVals.
-
setModel
void setModel(@Nullable() List<out Number> model, @NonNull() SimpleXYSeries.ArrayFormat format)
Use the provided list of Numbers as yVals and their corresponding indexes as xVals.
- Parameters:
model- A List of Number elements comprising the data model.format- Format of the model.
-
resize
void resize(int size)
Resize to accommodate the specified number of x/y pairs. If elements must be droped, those at the highest iVal should be removed first.
-
setXY
void setXY(@Nullable() Number xVal, @Nullable() Number yVal, int index)
Sets xy values based on index. If this series uses implicit x-vals (see useImplicitXVals) only the y value is set; xVal is ignored.
-
removeFirst
@NonNull() XYCoords removeFirst()
- Returns:
XYCoords with first equal to x-val and second equal to y-val.
-
removeLast
@NonNull() XYCoords removeLast()
- Returns:
XYCoords with first equal to x-val and second equal to y-val.
-
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.
-
getxVals
@Nullable() LinkedList<Number> getxVals()
-
getyVals
@NonNull() LinkedList<Number> getyVals()
-
clear
void clear()
Remove all values from the series
-
-
-
-