public class LegendRenderer
extends java.lang.Object
Modifier and Type | Class and Description |
---|---|
static class |
LegendRenderer.LegendAlign
alignment of the legend
|
Constructor and Description |
---|
LegendRenderer(GraphView graphView)
creates legend renderer
|
Modifier and Type | Method and Description |
---|---|
void |
draw(Canvas canvas)
draws the legend if it is visible
|
LegendRenderer.LegendAlign |
getAlign() |
protected java.util.List<Series> |
getAllSeries() |
int |
getBackgroundColor() |
int |
getMargin() |
int |
getPadding()
padding is the space between the edge of the box
and the beginning of the text
|
int |
getSpacing() |
int |
getTextColor() |
float |
getTextSize() |
int |
getWidth()
the width of the box exclusive padding
|
boolean |
isVisible() |
void |
resetStyles()
resets the styles to the defaults
and clears the legend width cache
|
void |
setAlign(LegendRenderer.LegendAlign align) |
void |
setBackgroundColor(int backgroundColor) |
void |
setFixedPosition(int x,
int y)
Use fixed coordinates to position the legend.
|
void |
setMargin(int margin) |
void |
setPadding(int padding)
padding is the space between the edge of the box
and the beginning of the text
|
void |
setSpacing(int spacing)
set the spacing between the text lines
|
void |
setTextColor(int textColor) |
void |
setTextSize(float textSize)
sets the font size.
|
void |
setVisible(boolean mIsVisible)
set the flag whether the legend will be drawn
|
void |
setWidth(int width)
the width of the box exclusive padding
|
public LegendRenderer(GraphView graphView)
graphView
- regarding graphviewpublic void resetStyles()
protected java.util.List<Series> getAllSeries()
public void draw(Canvas canvas)
canvas
- canvassetVisible(boolean)
public boolean isVisible()
public void setVisible(boolean mIsVisible)
mIsVisible
- visible flagpublic float getTextSize()
public void setTextSize(float textSize)
textSize
- font sizepublic int getSpacing()
public void setSpacing(int spacing)
spacing
- the spacing between the text linespublic int getPadding()
public void setPadding(int padding)
padding
- padding from edge to textpublic int getWidth()
public void setWidth(int width)
width
- the width of the box exclusive padding
0 => autopublic int getBackgroundColor()
public void setBackgroundColor(int backgroundColor)
backgroundColor
- background color of the box
it is recommended to use semi-transparent
color.public int getMargin()
public void setMargin(int margin)
margin
- margin from the edge of the box
to the corner of the graphviewpublic LegendRenderer.LegendAlign getAlign()
public void setAlign(LegendRenderer.LegendAlign align)
align
- the vertical alignment of the boxpublic int getTextColor()
public void setTextColor(int textColor)
textColor
- font colorpublic void setFixedPosition(int x, int y)
x
- x coordinates in pixely
- y coordinates in pixel