-
- 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 enum
SimpleXYSeries.ArrayFormat
-
Field Summary
Fields Modifier and Type Field Description private volatile String
title
private OrderedXYSeries.XOrder
xOrder
-
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 String
getTitle()
void
setTitle(String title)
OrderedXYSeries.XOrder
getXOrder()
Retrieve the current x-ordering specified for this series. void
setXOrder(OrderedXYSeries.XOrder xOrder)
If XVals are in strict ascending order, use this method to set ASCENDING to provide an optimizationhint to the renderer. void
onBeforeDraw(Plot source, Canvas canvas)
Fired immediately before the Plot "source" is drawn onto canvas.Commonly used by implementing Series instances to activate a readlock on it's self in preparation for the Plot's imminent readingof that series. void
onAfterDraw(Plot source, Canvas canvas)
Fired immediately after the Plot "source" is drawn onto canvas.Just as onBeforeDraw(...) is commonly used by Series implementationsto activate a read lock, this method is commonly used to release thatsame lock. void
useImplicitXVals()
Use index value as xVal, instead of explicit, user provided xVals. void
setModel(List<out Number> model, SimpleXYSeries.ArrayFormat format)
Use the provided list of Numbers as yVals and their corresponding indexes as xVals. void
setX(Number value, int index)
Sets individual x value based on index void
setY(Number value, int index)
Sets individual y value based on index void
resize(int size)
Resize to accommodate the specified number of x/y pairs. void
setXY(Number xVal, Number yVal, int index)
Sets xy values based on index void
addFirst(Number x, Number y)
XYCoords
removeFirst()
void
addLast(Number x, Number y)
XYCoords
removeLast()
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. LinkedList<Number>
getxVals()
LinkedList<Number>
getyVals()
void
clear()
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.- Parameters:
model
- A List of Number elements comprising the data model.format
- Format of the model.title
- Title of the series
-
-
Method Detail
-
getXOrder
OrderedXYSeries.XOrder getXOrder()
Retrieve the current x-ordering specified for this series. Default is NONE.
-
setXOrder
void setXOrder(OrderedXYSeries.XOrder xOrder)
If XVals are in strict ascending order, use this method to set ASCENDING to provide an optimizationhint to the renderer.
-
onBeforeDraw
void onBeforeDraw(Plot source, Canvas canvas)
Fired immediately before the Plot "source" is drawn onto canvas.Commonly used by implementing Series instances to activate a readlock on it's self in preparation for the Plot's imminent readingof that series.
-
onAfterDraw
void onAfterDraw(Plot source, Canvas canvas)
Fired immediately after the Plot "source" is drawn onto canvas.Just as onBeforeDraw(...) is commonly used by Series implementationsto activate a read lock, this method is commonly used to release thatsame lock.
-
useImplicitXVals
void useImplicitXVals()
Use index value as xVal, instead of explicit, user provided xVals.
-
setModel
void setModel(List<out Number> model, 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, thoseat the highest iVal should be removed first.
-
removeFirst
XYCoords removeFirst()
-
removeLast
XYCoords removeLast()
-
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
).
-
getxVals
LinkedList<Number> getxVals()
-
getyVals
LinkedList<Number> getyVals()
-
clear
void clear()
Remove all values from the series
-
-
-
-