public class LegendRenderer extends Renderer
| Modifier and Type | Field and Description |
|---|---|
protected java.util.List<LegendEntry> |
computedEntries |
protected android.graphics.Paint.FontMetrics |
legendFontMetrics |
protected Legend |
mLegend
the legend object this renderer renders
|
protected android.graphics.Paint |
mLegendFormPaint
paint used for the legend forms
|
protected android.graphics.Paint |
mLegendLabelPaint
paint for the legend labels
|
mViewPortHandler| Constructor and Description |
|---|
LegendRenderer(ViewPortHandler viewPortHandler,
Legend legend) |
| Modifier and Type | Method and Description |
|---|---|
void |
computeLegend(ChartData<?> data)
Prepares the legend and calculates all needed forms, labels and colors.
|
protected void |
drawForm(android.graphics.Canvas c,
float x,
float y,
LegendEntry entry,
Legend legend)
Draws the Legend-form at the given position with the color at the given
index.
|
protected void |
drawLabel(android.graphics.Canvas c,
float x,
float y,
java.lang.String label)
Draws the provided label at the given position.
|
android.graphics.Paint |
getFormPaint()
Returns the Paint object used for drawing the Legend forms.
|
android.graphics.Paint |
getLabelPaint()
Returns the Paint object used for drawing the Legend labels.
|
void |
renderLegend(android.graphics.Canvas c) |
protected android.graphics.Paint mLegendLabelPaint
protected android.graphics.Paint mLegendFormPaint
protected Legend mLegend
protected java.util.List<LegendEntry> computedEntries
protected android.graphics.Paint.FontMetrics legendFontMetrics
public LegendRenderer(ViewPortHandler viewPortHandler, Legend legend)
public android.graphics.Paint getLabelPaint()
public android.graphics.Paint getFormPaint()
public void computeLegend(ChartData<?> data)
data - public void renderLegend(android.graphics.Canvas c)
protected void drawForm(android.graphics.Canvas c,
float x,
float y,
LegendEntry entry,
Legend legend)
c - canvas to draw withx - positiony - positionentry - the entry to renderlegend - the legend contextprotected void drawLabel(android.graphics.Canvas c,
float x,
float y,
java.lang.String label)
c - canvas to draw withx - y - label - the label to draw