|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.ObjectLinearLayout
com.jjoe64.graphview.GraphView
public abstract class GraphView
GraphView is a Android View for creating zoomable and scrollable graphs.
This is the abstract base class for all graphs. Extend this class and implement #drawSeries(Canvas, GraphViewDataInterface[], float, float, float, double, double, double, double, float)
to display a custom graph.
Use LineGraphView
for creating a line chart.
Nested Class Summary | |
---|---|
static class |
GraphView.GraphViewData
one data set for a graph series |
static class |
GraphView.LegendAlign
|
Field Summary | |
---|---|
protected Paint |
paint
|
Constructor Summary | |
---|---|
GraphView(Context context,
AttributeSet attrs)
|
|
GraphView(Context context,
java.lang.String title)
|
Method Summary | |
---|---|
void |
addSeries(GraphViewSeries series)
add a series of data to the graph |
protected void |
drawLegend(Canvas canvas,
float height,
float width)
|
protected abstract void |
drawSeries(Canvas canvas,
GraphViewDataInterface[] values,
float graphwidth,
float graphheight,
float border,
double minX,
double minY,
double diffX,
double diffY,
float horstart,
GraphViewSeries.GraphViewSeriesStyle style)
|
protected java.lang.String |
formatLabel(double value,
boolean isValueX)
Deprecated. use setCustomLabelFormatter(CustomLabelFormatter) |
CustomLabelFormatter |
getCustomLabelFormatter()
|
GraphViewStyle |
getGraphViewStyle()
|
GraphView.LegendAlign |
getLegendAlign()
get the position of the legend |
float |
getLegendWidth()
|
protected double |
getMaxX(boolean ignoreViewport)
returns the maximal X value of the current viewport (if viewport is set) otherwise maximal X value of all data. |
protected double |
getMaxY()
returns the maximal Y value of all data. |
protected double |
getMinX(boolean ignoreViewport)
returns the minimal X value of the current viewport (if viewport is set) otherwise minimal X value of all data. |
protected double |
getMinY()
returns the minimal Y value of all data. |
boolean |
isDisableTouch()
|
boolean |
isScrollable()
|
boolean |
isShowLegend()
|
void |
redrawAll()
forces graphview to invalide all views and caches. |
void |
removeAllSeries()
removes all series |
void |
removeSeries(GraphViewSeries series)
removes a series |
void |
removeSeries(int index)
removes series |
void |
scrollToEnd()
scrolls to the last x-value |
void |
setCustomLabelFormatter(CustomLabelFormatter customLabelFormatter)
set a custom label formatter |
void |
setDisableTouch(boolean disableTouch)
The user can disable any touch gestures, this is useful if you are using a real time graph, but don't want the user to interact |
void |
setGraphViewStyle(GraphViewStyle style)
set custom graphview style |
void |
setHorizontalLabels(java.lang.String[] horlabels)
set's static horizontal labels (from left to right) |
void |
setLegendAlign(GraphView.LegendAlign legendAlign)
legend position |
void |
setLegendWidth(float legendWidth)
legend width |
void |
setManualYAxis(boolean manualYAxis)
you have to set the bounds setManualYAxisBounds(double, double) . |
void |
setManualYAxisBounds(double max,
double min)
set manual Y axis limit |
void |
setScalable(boolean scalable)
this forces scrollable = true |
void |
setScrollable(boolean scrollable)
the user can scroll (horizontal) the graph. |
void |
setShowLegend(boolean showLegend)
|
void |
setTitle(java.lang.String title)
sets the title of graphview |
void |
setVerticalLabels(java.lang.String[] verlabels)
set's static vertical labels (from top to bottom) |
void |
setViewPort(double start,
double size)
set's the viewport for the graph. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
protected final Paint paint
Constructor Detail |
---|
public GraphView(Context context, AttributeSet attrs)
public GraphView(Context context, java.lang.String title)
context
- title
- [optional]Method Detail |
---|
public void addSeries(GraphViewSeries series)
series
- protected void drawLegend(Canvas canvas, float height, float width)
protected abstract void drawSeries(Canvas canvas, GraphViewDataInterface[] values, float graphwidth, float graphheight, float border, double minX, double minY, double diffX, double diffY, float horstart, GraphViewSeries.GraphViewSeriesStyle style)
@Deprecated protected java.lang.String formatLabel(double value, boolean isValueX)
setCustomLabelFormatter(CustomLabelFormatter)
value
- x and y valuesisValueX
- if false, value y wants to be formatted
public CustomLabelFormatter getCustomLabelFormatter()
public GraphViewStyle getGraphViewStyle()
public GraphView.LegendAlign getLegendAlign()
public float getLegendWidth()
protected double getMaxX(boolean ignoreViewport)
ignoreViewport
- warning: only override this, if you really know want you're doing!protected double getMaxY()
protected double getMinX(boolean ignoreViewport)
ignoreViewport
- warning: only override this, if you really know want you're doing!protected double getMinY()
public boolean isDisableTouch()
public boolean isScrollable()
public boolean isShowLegend()
public void redrawAll()
public void removeAllSeries()
public void removeSeries(GraphViewSeries series)
series
- series to removepublic void removeSeries(int index)
index
- public void scrollToEnd()
java.lang.IllegalStateException
- if scrollable == falsepublic void setCustomLabelFormatter(CustomLabelFormatter customLabelFormatter)
customLabelFormatter
- public void setDisableTouch(boolean disableTouch)
disableTouch
- public void setGraphViewStyle(GraphViewStyle style)
style
- public void setHorizontalLabels(java.lang.String[] horlabels)
horlabels
- if null, labels were generated automaticallypublic void setLegendAlign(GraphView.LegendAlign legendAlign)
legendAlign
- public void setLegendWidth(float legendWidth)
legendWidth
- public void setManualYAxis(boolean manualYAxis)
setManualYAxisBounds(double, double)
. That automatically enables manualYAxis-flag.
if you want to disable the menual y axis, call this method with false.
manualYAxis
- public void setManualYAxisBounds(double max, double min)
max
- min
- public void setScalable(boolean scalable)
scalable
- public void setScrollable(boolean scrollable)
setViewPort(double, double)
which doesn't displays all data.
scrollable
- public void setShowLegend(boolean showLegend)
public void setTitle(java.lang.String title)
title
- public void setVerticalLabels(java.lang.String[] verlabels)
verlabels
- if null, labels were generated automaticallypublic void setViewPort(double start, double size)
start
- x-valuesize
- to limit the y-viewport
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |