public class LineGraphSeries<E extends DataPointInterface> extends BaseSeries<E>
mOnDataPointTapListener
Constructor and Description |
---|
LineGraphSeries()
creates a series without data
|
LineGraphSeries(E[] data)
creates a series with data
|
Modifier and Type | Method and Description |
---|---|
void |
appendData(E dataPoint,
boolean scrollToEnd,
int maxDataPoints,
boolean silent) |
void |
draw(GraphView graphView,
Canvas canvas,
boolean isSecondScale)
plots the series
draws the line and the background
|
void |
drawSelection(GraphView graphView,
Canvas canvas,
boolean b,
DataPointInterface value) |
int |
getBackgroundColor() |
float |
getDataPointsRadius() |
int |
getThickness()
the thickness of the line.
|
protected void |
init()
do the initialization
creates internal objects
|
boolean |
isDrawAsPath()
flag whether the line should be drawn as a path
or with single drawLine commands (more performance)
By default we use drawLine because it has much more peformance.
|
boolean |
isDrawBackground()
flag whether the area under the line to the bottom
of the viewport will be filled with a
specific background color.
|
boolean |
isDrawDataPoints()
flag whether the data points are highlighted as
a visible point.
|
void |
setAnimated(boolean animated) |
void |
setBackgroundColor(int backgroundColor) |
void |
setCustomPaint(Paint customPaint)
custom paint that can be used.
|
void |
setDataPointsRadius(float dataPointsRadius) |
void |
setDrawAsPath(boolean mDrawAsPath)
flag whether the line should be drawn as a path
or with single drawLine commands (more performance)
By default we use drawLine because it has much more peformance.
|
void |
setDrawBackground(boolean drawBackground)
flag whether the area under the line to the bottom
of the viewport will be filled with a
specific background color.
|
void |
setDrawDataPoints(boolean drawDataPoints)
flag whether the data points are highlighted as
a visible point.
|
void |
setThickness(int thickness)
the thickness of the line.
|
appendData, checkValueOrder, clearCursorModeCache, clearReference, findDataPoint, findDataPointAtX, getColor, getHighestValueX, getHighestValueY, getLowestValueX, getLowestValueY, getTitle, getValues, isEmpty, onGraphViewAttached, onTap, registerDataPoint, resetData, resetDataPoints, setColor, setOnDataPointTapListener, setTitle
public LineGraphSeries()
public LineGraphSeries(E[] data)
data
- data points
important: array has to be sorted from lowest x-value to the highestprotected void init()
public void draw(GraphView graphView, Canvas canvas, boolean isSecondScale)
graphView
- graphviewcanvas
- canvasisSecondScale
- flag if it is the second scalepublic int getThickness()
#setCustomPaint(android.graphics.Paint)
public void setThickness(int thickness)
#setCustomPaint(android.graphics.Paint)
thickness
- thickness of the linepublic boolean isDrawBackground()
getBackgroundColor()
public void setDrawBackground(boolean drawBackground)
drawBackground
- whether the background will be drawnsetBackgroundColor(int)
public boolean isDrawDataPoints()
setDataPointsRadius(float)
public void setDrawDataPoints(boolean drawDataPoints)
drawDataPoints
- flag whether the data points are highlightedsetDataPointsRadius(float)
public float getDataPointsRadius()
setDrawDataPoints(boolean)
public void setDataPointsRadius(float dataPointsRadius)
dataPointsRadius
- the radius for the data points.setDrawDataPoints(boolean)
public int getBackgroundColor()
setDrawBackground(boolean)
public void setBackgroundColor(int backgroundColor)
backgroundColor
- the background color for the filling under
the line.setDrawBackground(boolean)
public void setCustomPaint(Paint customPaint)
customPaint
- the custom paint to be used for rendering the linepublic void setAnimated(boolean animated)
animated
- activate the animated renderingpublic boolean isDrawAsPath()
public void setDrawAsPath(boolean mDrawAsPath)
mDrawAsPath
- true to draw as pathpublic void appendData(E dataPoint, boolean scrollToEnd, int maxDataPoints, boolean silent)
appendData
in class BaseSeries<E extends DataPointInterface>
dataPoint
- values the values must be in the correct order!
x-value has to be ASC. First the lowest x value and at least the highest x value.scrollToEnd
- true => graphview will scroll to the end (maxX)maxDataPoints
- if max data count is reached, the oldest data
value will be lost to avoid memory leakssilent
- set true to avoid rerender the graphpublic void drawSelection(GraphView graphView, Canvas canvas, boolean b, DataPointInterface value)
drawSelection
in class BaseSeries<E extends DataPointInterface>