public class Legend extends ComponentBase
| Modifier and Type | Class and Description |
|---|---|
static class |
Legend.LegendDirection |
static class |
Legend.LegendForm |
static class |
Legend.LegendHorizontalAlignment |
static class |
Legend.LegendOrientation |
static class |
Legend.LegendPosition
Deprecated.
|
static class |
Legend.LegendVerticalAlignment |
| 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)
Deprecated.
|
Legend(LegendEntry[] entries)
Constructor.
|
Legend(java.util.List<java.lang.Integer> colors,
java.util.List<java.lang.String> labels)
Deprecated.
|
| Modifier and Type | Method and Description |
|---|---|
void |
calculateDimensions(android.graphics.Paint labelpaint,
ViewPortHandler viewPortHandler)
Calculates the dimensions of the Legend.
|
java.util.List<java.lang.Boolean> |
getCalculatedLabelBreakPoints() |
java.util.List<FSize> |
getCalculatedLabelSizes() |
java.util.List<FSize> |
getCalculatedLineSizes() |
int[] |
getColors()
Deprecated.
|
Legend.LegendDirection |
getDirection()
returns the text direction of the legend
|
LegendEntry[] |
getEntries() |
int[] |
getExtraColors()
Deprecated.
|
LegendEntry[] |
getExtraEntries() |
java.lang.String[] |
getExtraLabels()
Deprecated.
|
Legend.LegendForm |
getForm()
returns the current form/shape that is set for the legend
|
android.graphics.DashPathEffect |
getFormLineDashEffect() |
float |
getFormLineWidth()
returns the line width in dp for drawing forms that consist of lines
|
float |
getFormSize()
returns the size in dp of the legend forms
|
float |
getFormToTextSpace()
returns the space between the form and the actual label/text
|
Legend.LegendHorizontalAlignment |
getHorizontalAlignment()
returns the horizontal alignment of the legend
|
java.lang.String[] |
getLabels()
Deprecated.
|
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.LegendOrientation |
getOrientation()
returns the orientation of the legend
|
Legend.LegendPosition |
getPosition()
Deprecated.
|
float |
getStackSpace()
returns the space that is left out between stacked forms (with no label)
|
Legend.LegendVerticalAlignment |
getVerticalAlignment()
returns the vertical alignment of the legend
|
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 |
isDrawInsideEnabled()
returns whether the legend will draw inside the chart or outside
|
boolean |
isLegendCustom() |
boolean |
isWordWrapEnabled()
If this is set, then word wrapping the legend is enabled.
|
void |
resetCustom()
Calling this will disable the custom legend entries (set by
setCustom(...)).
|
void |
setCustom(LegendEntry[] entries)
Sets a custom legend's entries array.
|
void |
setCustom(java.util.List<LegendEntry> entries)
Sets a custom legend's entries array.
|
void |
setDirection(Legend.LegendDirection pos)
sets the text direction of the legend
|
void |
setDrawInside(boolean value)
sets whether the legend will draw inside the chart or outside
|
void |
setEntries(java.util.List<LegendEntry> entries)
This method sets the automatically computed colors for the legend.
|
void |
setExtra(int[] colors,
java.lang.String[] labels)
Entries that will be appended to the end of the auto calculated
entries after calculating the legend.
|
void |
setExtra(LegendEntry[] entries) |
void |
setExtra(java.util.List<java.lang.Integer> colors,
java.util.List<java.lang.String> labels)
Deprecated.
|
void |
setExtra(java.util.List<LegendEntry> entries) |
void |
setForm(Legend.LegendForm shape)
sets the form/shape of the legend forms
|
void |
setFormLineDashEffect(android.graphics.DashPathEffect dashPathEffect)
Sets the line dash path effect used for shapes that consist of lines.
|
void |
setFormLineWidth(float size)
sets the line width in dp for forms that consist of lines, default 3f
|
void |
setFormSize(float size)
sets the size in dp of the legend forms, default 8f
|
void |
setFormToTextSpace(float space)
sets the space between the form and the actual label/text, converts to dp
internally
|
void |
setHorizontalAlignment(Legend.LegendHorizontalAlignment value)
sets the horizontal alignment of the legend
|
void |
setMaxSizePercent(float maxSize)
The maximum relative size out of the whole chart view.
|
void |
setOrientation(Legend.LegendOrientation value)
sets the orientation of the legend
|
void |
setPosition(Legend.LegendPosition newValue)
Deprecated.
|
void |
setStackSpace(float space)
sets the space that is left out between stacked forms (with no label)
|
void |
setVerticalAlignment(Legend.LegendVerticalAlignment value)
sets the vertical alignment of the legend
|
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(LegendEntry[] entries)
entries - @Deprecated
public Legend(int[] colors,
java.lang.String[] labels)
@Deprecated
public Legend(java.util.List<java.lang.Integer> colors,
java.util.List<java.lang.String> labels)
public void setEntries(java.util.List<LegendEntry> entries)
entries - public LegendEntry[] getEntries()
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 text@Deprecated public int[] getColors()
@Deprecated public java.lang.String[] getLabels()
@Deprecated public int[] getExtraColors()
@Deprecated public java.lang.String[] getExtraLabels()
public LegendEntry[] getExtraEntries()
public void setExtra(java.util.List<LegendEntry> entries)
public void setExtra(LegendEntry[] entries)
@Deprecated
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(LegendEntry[] entries)
public void setCustom(java.util.List<LegendEntry> entries)
public void resetCustom()
public boolean isLegendCustom()
@Deprecated public Legend.LegendPosition getPosition()
@Deprecated public void setPosition(Legend.LegendPosition newValue)
public Legend.LegendHorizontalAlignment getHorizontalAlignment()
public void setHorizontalAlignment(Legend.LegendHorizontalAlignment value)
value - public Legend.LegendVerticalAlignment getVerticalAlignment()
public void setVerticalAlignment(Legend.LegendVerticalAlignment value)
value - public Legend.LegendOrientation getOrientation()
public void setOrientation(Legend.LegendOrientation value)
value - public boolean isDrawInsideEnabled()
public void setDrawInside(boolean value)
value - 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 void setFormLineWidth(float size)
size - public float getFormLineWidth()
public void setFormLineDashEffect(android.graphics.DashPathEffect dashPathEffect)
dashPathEffect - public android.graphics.DashPathEffect getFormLineDashEffect()
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)
space - public float getStackSpace()
public void setStackSpace(float space)
space - public void setWordWrapEnabled(boolean enabled)
enabled - public boolean isWordWrapEnabled()
public float getMaxSizePercent()
public void setMaxSizePercent(float maxSize)
maxSize - public java.util.List<FSize> getCalculatedLabelSizes()
public java.util.List<java.lang.Boolean> getCalculatedLabelBreakPoints()
public java.util.List<FSize> getCalculatedLineSizes()
public void calculateDimensions(android.graphics.Paint labelpaint,
ViewPortHandler viewPortHandler)
labelpaint -