public class Legend extends ComponentBase
| Modifier and Type | Class and Description |
|---|---|
static class |
Legend.LegendDirection |
static class |
Legend.LegendForm |
static class |
Legend.LegendPosition |
| Modifier and Type | Field and Description |
|---|---|
float |
mNeededHeight
the total height of the legend (needed height space)
|
float |
mNeededWidth
the total width of the legend (needed width space)
|
float |
mTextHeightMax |
float |
mTextWidthMax |
mEnabled, mTextColor, mTextSize, mTypeface, mXOffset, mYOffset| Constructor and Description |
|---|
Legend()
default constructor
|
Legend(int[] colors,
java.lang.String[] labels)
Constructor.
|
Legend(java.util.List<java.lang.Integer> colors,
java.util.List<java.lang.String> labels)
Constructor.
|
| Modifier and Type | Method and Description |
|---|---|
void |
calculateDimensions(android.graphics.Paint labelpaint,
ViewPortHandler viewPortHandler)
Calculates the dimensions of the Legend.
|
java.lang.Boolean[] |
getCalculatedLabelBreakPoints() |
FSize[] |
getCalculatedLabelSizes() |
FSize[] |
getCalculatedLineSizes() |
int[] |
getColors()
returns all the colors the legend uses
|
Legend.LegendDirection |
getDirection()
returns the text direction of the legend
|
int[] |
getExtraColors()
colors that will be appended to the end of the colors array after
calculating the legend.
|
java.lang.String[] |
getExtraLabels()
labels that will be appended to the end of the labels array after
calculating the legend.
|
Legend.LegendForm |
getForm()
returns the current form/shape that is set for the legend
|
float |
getFormSize()
returns the size in dp of the legend forms
|
float |
getFormToTextSpace()
returns the space between the form and the actual label/text
|
float |
getFullHeight(android.graphics.Paint labelpaint)
Calculates the full height of the drawn legend.
|
float |
getFullWidth(android.graphics.Paint labelpaint)
calculates the full width the fully drawn legend will use in pixels
|
java.lang.String |
getLabel(int index)
Returns the legend-label at the given index.
|
java.lang.String[] |
getLabels()
returns all the labels the legend uses
|
float |
getMaximumEntryHeight(android.graphics.Paint p)
returns the maximum height in pixels across all legend labels
|
float |
getMaximumEntryWidth(android.graphics.Paint p)
returns the maximum length in pixels across all legend labels + formsize
+ formtotextspace
|
float |
getMaxSizePercent()
The maximum relative size out of the whole chart view.
|
Legend.LegendPosition |
getPosition()
returns the position of the legend relative to the chart
|
float |
getStackSpace()
returns the space that is left out between stacked forms (with no label)
|
float |
getXEntrySpace()
returns the space between the legend entries on a horizontal axis in
pixels
|
float |
getYEntrySpace()
returns the space between the legend entries on a vertical axis in pixels
|
boolean |
isLegendCustom() |
boolean |
isWordWrapEnabled()
If this is set, then word wrapping the legend is enabled.
|
void |
resetCustom()
Calling this will disable the custom legend labels (set by
setCustom(...)).
|
void |
setComputedColors(java.util.List<java.lang.Integer> colors)
This method sets the automatically computed colors for the legend.
|
void |
setComputedLabels(java.util.List<java.lang.String> labels)
This method sets the automatically computed labels for the legend.
|
void |
setCustom(int[] colors,
java.lang.String[] labels)
Sets a custom legend's labels and colors arrays.
|
void |
setCustom(java.util.List<java.lang.Integer> colors,
java.util.List<java.lang.String> labels)
Sets a custom legend's labels and colors arrays.
|
void |
setDirection(Legend.LegendDirection pos)
sets the text direction of the legend
|
void |
setExtra(int[] colors,
java.lang.String[] labels)
Colors and labels that will be appended to the end of the auto calculated
colors and labels arrays after calculating the legend.
|
void |
setExtra(java.util.List<java.lang.Integer> colors,
java.util.List<java.lang.String> labels)
Colors and labels that will be appended to the end of the auto calculated
colors and labels arrays after calculating the legend.
|
void |
setForm(Legend.LegendForm shape)
sets the form/shape of the legend forms
|
void |
setFormSize(float size)
sets the size in pixels of the legend forms, this is internally converted
in dp, default 8f
|
void |
setFormToTextSpace(float space)
sets the space between the form and the actual label/text, converts to dp
internally
|
void |
setMaxSizePercent(float maxSize)
The maximum relative size out of the whole chart view.
|
void |
setPosition(Legend.LegendPosition pos)
sets the position of the legend relative to the whole chart
|
void |
setStackSpace(float space)
sets the space that is left out between stacked forms (with no label)
|
void |
setWordWrapEnabled(boolean enabled)
Should the legend word wrap? / this is currently supported only for:
BelowChartLeft, BelowChartRight, BelowChartCenter.
|
void |
setXEntrySpace(float space)
sets the space between the legend entries on a horizontal axis in pixels,
converts to dp internally
|
void |
setYEntrySpace(float space)
sets the space between the legend entries on a vertical axis in pixels,
converts to dp internally
|
getTextColor, getTextSize, getTypeface, getXOffset, getYOffset, isEnabled, setEnabled, setTextColor, setTextSize, setTypeface, setXOffset, setYOffsetpublic float mNeededWidth
public float mNeededHeight
public float mTextHeightMax
public float mTextWidthMax
public Legend()
public Legend(int[] colors,
java.lang.String[] labels)
colors - labels - public Legend(java.util.List<java.lang.Integer> colors,
java.util.List<java.lang.String> labels)
colors - labels - public void setComputedColors(java.util.List<java.lang.Integer> colors)
colors - public void setComputedLabels(java.util.List<java.lang.String> labels)
labels - public float getMaximumEntryWidth(android.graphics.Paint p)
p - the paint object used for rendering the textpublic float getMaximumEntryHeight(android.graphics.Paint p)
p - the paint object used for rendering the textpublic int[] getColors()
public java.lang.String[] getLabels()
public java.lang.String getLabel(int index)
index - public int[] getExtraColors()
public java.lang.String[] getExtraLabels()
public void setExtra(java.util.List<java.lang.Integer> colors,
java.util.List<java.lang.String> labels)
public void setExtra(int[] colors,
java.lang.String[] labels)
public void setCustom(int[] colors,
java.lang.String[] labels)
public void setCustom(java.util.List<java.lang.Integer> colors,
java.util.List<java.lang.String> labels)
public void resetCustom()
public boolean isLegendCustom()
public Legend.LegendPosition getPosition()
public void setPosition(Legend.LegendPosition pos)
pos - public Legend.LegendDirection getDirection()
public void setDirection(Legend.LegendDirection pos)
pos - public Legend.LegendForm getForm()
public void setForm(Legend.LegendForm shape)
shape - public void setFormSize(float size)
size - public float getFormSize()
public float getXEntrySpace()
public void setXEntrySpace(float space)
space - public float getYEntrySpace()
public void setYEntrySpace(float space)
space - public float getFormToTextSpace()
public void setFormToTextSpace(float space)
mFormToTextSpace - public float getStackSpace()
public void setStackSpace(float space)
space - public float getFullWidth(android.graphics.Paint labelpaint)
public float getFullHeight(android.graphics.Paint labelpaint)
mLegendLabelPaint - public void setWordWrapEnabled(boolean enabled)
enabled - public boolean isWordWrapEnabled()
public float getMaxSizePercent()
public void setMaxSizePercent(float maxSize)
maxSize - public FSize[] getCalculatedLabelSizes()
public java.lang.Boolean[] getCalculatedLabelBreakPoints()
public FSize[] getCalculatedLineSizes()
public void calculateDimensions(android.graphics.Paint labelpaint,
ViewPortHandler viewPortHandler)
labelpaint -