public class BarGraphSeries<E extends DataPointInterface> extends BaseSeries<E>
mOnDataPointTapListener| Constructor and Description |
|---|
BarGraphSeries()
creates bar series without any data
|
BarGraphSeries(E[] data)
creates bar series with data
|
| Modifier and Type | Method and Description |
|---|---|
void |
draw(GraphView graphView,
Canvas canvas,
boolean isSecondScale)
draws the bars on the canvas
|
void |
drawSelection(GraphView mGraphView,
Canvas canvas,
boolean b,
DataPointInterface value) |
protected E |
findDataPoint(float x,
float y)
find the corresponding data point by
coordinates.
|
Paint |
getCustomPaint()
custom paint that can be used.
|
double |
getDataWidth() |
int |
getSpacing() |
ValueDependentColor<E> |
getValueDependentColor() |
int |
getValuesOnTopColor() |
float |
getValuesOnTopSize() |
boolean |
isAnimated() |
boolean |
isDrawValuesOnTop() |
protected void |
resetDataPoints()
resets the cached coordinates of the bars
|
void |
setAnimated(boolean animated)
draw the series with an animation
|
void |
setCustomPaint(Paint mCustomPaint)
custom paint that can be used.
|
void |
setDataWidth(double mDataWidth) |
void |
setDrawValuesOnTop(boolean mDrawValuesOnTop) |
void |
setSpacing(int mSpacing) |
void |
setValueDependentColor(ValueDependentColor<E> mValueDependentColor)
set a hook to make the color of the bars depending
on the actually value/data.
|
void |
setValuesOnTopColor(int mValuesOnTopColor) |
void |
setValuesOnTopSize(float mValuesOnTopSize) |
appendData, appendData, checkValueOrder, clearCursorModeCache, clearReference, findDataPointAtX, getColor, getHighestValueX, getHighestValueY, getLowestValueX, getLowestValueY, getTitle, getValues, isEmpty, onGraphViewAttached, onTap, registerDataPoint, resetData, setColor, setOnDataPointTapListener, setTitlepublic BarGraphSeries()
public BarGraphSeries(E[] data)
data - data points
important: array has to be sorted from lowest x-value to the highestpublic void draw(GraphView graphView, Canvas canvas, boolean isSecondScale)
graphView - corresponding graphviewcanvas - canvasisSecondScale - whether we are plotting the second scale or notpublic ValueDependentColor<E> getValueDependentColor()
public void setValueDependentColor(ValueDependentColor<E> mValueDependentColor)
mValueDependentColor - hook
null to disablepublic int getSpacing()
public void setSpacing(int mSpacing)
mSpacing - spacing between the bars in percentage.
0 => no spacing
100 => the space between the bars is as big as the bars itselfpublic double getDataWidth()
public void setDataWidth(double mDataWidth)
mDataWidth - width of a data point (sampling period)
0 => no prior knowledge of sampling period, interval between bars will be calculated automatically
>0 => value is the total distance from one bar to anotherpublic boolean isDrawValuesOnTop()
public void setDrawValuesOnTop(boolean mDrawValuesOnTop)
mDrawValuesOnTop - flag whether the values should drawn
above the bars as textpublic int getValuesOnTopColor()
setDrawValuesOnTop(boolean)public void setValuesOnTopColor(int mValuesOnTopColor)
mValuesOnTopColor - the font color of the values on top of the barssetDrawValuesOnTop(boolean)public float getValuesOnTopSize()
setDrawValuesOnTop(boolean)public void setValuesOnTopSize(float mValuesOnTopSize)
mValuesOnTopSize - font size of the values above the barssetDrawValuesOnTop(boolean)protected void resetDataPoints()
resetDataPoints in class BaseSeries<E extends DataPointInterface>protected E findDataPoint(float x, float y)
findDataPoint in class BaseSeries<E extends DataPointInterface>x - pixelsy - pixelspublic Paint getCustomPaint()
public void setCustomPaint(Paint mCustomPaint)
mCustomPaint - custom paint to use or nullpublic void setAnimated(boolean animated)
animated - animation activated or notpublic boolean isAnimated()
public void drawSelection(GraphView mGraphView, Canvas canvas, boolean b, DataPointInterface value)
drawSelection in class BaseSeries<E extends DataPointInterface>