public abstract class AxisBase extends ComponentBase
| Modifier and Type | Field and Description |
|---|---|
float |
mAxisMaximum
don't touch this direclty, use setter
|
float |
mAxisMinimum
don't touch this directly, use setter
|
float |
mAxisRange
the total range of values this axis covers
|
protected IAxisValueFormatter |
mAxisValueFormatter
custom formatter that is used instead of the auto-formatter if set
|
protected boolean |
mCenterAxisLabels |
float[] |
mCenteredEntries
axis label entries only used for centered labels
|
protected boolean |
mCustomAxisMax
flag indicating that the axis-max value has been customized
|
protected boolean |
mCustomAxisMin
flag indicating that the axis-min value has been customized
|
int |
mDecimals
the number of decimal digits to use
|
protected boolean |
mDrawAxisLine
flag that indicates if the line alongside the axis is drawn or not
|
protected boolean |
mDrawGridLines
flag indicating if the grid lines for this axis should be drawn
|
protected boolean |
mDrawGridLinesBehindData
flag indicating the grid lines layer depth
|
protected boolean |
mDrawLabels
flag that indicates of the labels of this axis should be drawn or not
|
protected boolean |
mDrawLimitLineBehindData
flag indicating the limit lines layer depth
|
float[] |
mEntries
the actual array of entries
|
int |
mEntryCount
the number of entries the legend contains
|
protected boolean |
mForceLabels
if true, the set number of y-labels will be forced
|
protected float |
mGranularity
the minimum interval between axis values
|
protected boolean |
mGranularityEnabled
When true, axis labels are controlled by the `granularity` property.
|
protected java.util.List<LimitLine> |
mLimitLines
array of limit lines that can be set for the axis
|
protected float |
mSpaceMax
Extra spacing for `axisMaximum` to be added to automatically calculated `axisMaximum`
|
protected float |
mSpaceMin
Extra spacing for `axisMinimum` to be added to automatically calculated `axisMinimum`
|
mEnabled, mTextColor, mTextSize, mTypeface, mXOffset, mYOffset| Constructor and Description |
|---|
AxisBase()
default constructor
|
| Modifier and Type | Method and Description |
|---|---|
void |
addLimitLine(LimitLine l)
Adds a new LimitLine to this axis.
|
void |
calculate(float dataMin,
float dataMax)
Calculates the minimum / maximum and range values of the axis with the given
minimum and maximum values from the chart data.
|
void |
disableAxisLineDashedLine()
Disables the axis line to be drawn in dashed mode.
|
void |
disableGridDashedLine()
Disables the grid line to be drawn in dashed mode.
|
void |
enableAxisLineDashedLine(float lineLength,
float spaceLength,
float phase)
Enables the axis line to be drawn in dashed mode, e.g.
|
void |
enableGridDashedLine(float lineLength,
float spaceLength,
float phase)
Enables the grid line to be drawn in dashed mode, e.g.
|
int |
getAxisLineColor()
Returns the color of the axis line (line alongside the axis).
|
android.graphics.DashPathEffect |
getAxisLineDashPathEffect()
returns the DashPathEffect that is set for axis line
|
float |
getAxisLineWidth()
Returns the width of the axis line (line alongside the axis).
|
float |
getAxisMaximum()
###### BELOW CODE RELATED TO CUSTOM AXIS VALUES ######
|
float |
getAxisMinimum() |
java.lang.String |
getFormattedLabel(int index) |
float |
getGranularity() |
int |
getGridColor()
Returns the color of the grid lines for this axis (the horizontal lines
coming from each label).
|
android.graphics.DashPathEffect |
getGridDashPathEffect()
returns the DashPathEffect that is set for grid line
|
float |
getGridLineWidth()
Returns the width of the grid lines that are drawn away from each axis
label.
|
int |
getLabelCount()
Returns the number of label entries the y-axis should have
|
java.util.List<LimitLine> |
getLimitLines()
Returns the LimitLines of this axis.
|
java.lang.String |
getLongestLabel()
Returns the longest formatted label (in terms of characters), this axis
contains.
|
float |
getSpaceMax()
Gets extra spacing for `axisMaximum` to be added to automatically calculated `axisMaximum`
|
float |
getSpaceMin()
Gets extra spacing for `axisMinimum` to be added to automatically calculated `axisMinimum`
|
IAxisValueFormatter |
getValueFormatter()
Returns the formatter used for formatting the axis labels.
|
boolean |
isAxisLineDashedLineEnabled()
Returns true if the axis dashed-line effect is enabled, false if not.
|
boolean |
isAxisMaxCustom()
Returns true if the axis max value has been customized (and is not calculated automatically)
|
boolean |
isAxisMinCustom()
Returns true if the axis min value has been customized (and is not calculated automatically)
|
boolean |
isCenterAxisLabelsEnabled() |
boolean |
isDrawAxisLineEnabled()
Returns true if the line alongside the axis should be drawn.
|
boolean |
isDrawGridLinesBehindDataEnabled() |
boolean |
isDrawGridLinesEnabled()
Returns true if drawing grid lines is enabled for this axis.
|
boolean |
isDrawLabelsEnabled()
Returns true if drawing the labels is enabled for this axis.
|
boolean |
isDrawLimitLinesBehindDataEnabled() |
boolean |
isForceLabelsEnabled()
Returns true if focing the y-label count is enabled.
|
boolean |
isGranularityEnabled() |
boolean |
isGridDashedLineEnabled()
Returns true if the grid dashed-line effect is enabled, false if not.
|
void |
removeAllLimitLines()
Removes all LimitLines from the axis.
|
void |
removeLimitLine(LimitLine l)
Removes the specified LimitLine from the axis.
|
void |
resetAxisMaximum()
By calling this method, any custom maximum value that has been previously set is reseted,
and the calculation is
done automatically.
|
void |
resetAxisMinimum()
By calling this method, any custom minimum value that has been previously set is reseted,
and the calculation is
done automatically.
|
void |
setAxisLineColor(int color)
Sets the color of the border surrounding the chart.
|
void |
setAxisLineDashedLine(android.graphics.DashPathEffect effect)
Enables the axis line to be drawn in dashed mode, e.g.
|
void |
setAxisLineWidth(float width)
Sets the width of the border surrounding the chart in dp.
|
void |
setAxisMaximum(float max)
Set a custom maximum value for this axis.
|
void |
setAxisMaxValue(float max)
Deprecated.
|
void |
setAxisMinimum(float min)
Set a custom minimum value for this axis.
|
void |
setAxisMinValue(float min)
Deprecated.
|
void |
setCenterAxisLabels(boolean enabled)
Centers the axis labels instead of drawing them at their original position.
|
void |
setDrawAxisLine(boolean enabled)
Set this to true if the line alongside the axis should be drawn or not.
|
void |
setDrawGridLines(boolean enabled)
Set this to true to enable drawing the grid lines for this axis.
|
void |
setDrawGridLinesBehindData(boolean enabled)
If this is set to false, the grid lines are draw on top of the actual data,
otherwise behind.
|
void |
setDrawLabels(boolean enabled)
Set this to true to enable drawing the labels of this axis (this will not
affect drawing the grid lines or axis lines).
|
void |
setDrawLimitLinesBehindData(boolean enabled)
If this is set to true, the LimitLines are drawn behind the actual data,
otherwise on top.
|
void |
setGranularity(float granularity)
Set a minimum interval for the axis when zooming in.
|
void |
setGranularityEnabled(boolean enabled)
Enabled/disable granularity control on axis value intervals.
|
void |
setGridColor(int color)
Sets the color of the grid lines for this axis (the horizontal lines
coming from each label).
|
void |
setGridDashedLine(android.graphics.DashPathEffect effect)
Enables the grid line to be drawn in dashed mode, e.g.
|
void |
setGridLineWidth(float width)
Sets the width of the grid lines that are drawn away from each axis
label.
|
void |
setLabelCount(int count)
Sets the number of label entries for the y-axis max = 25, min = 2, default: 6, be aware
that this number is not fixed.
|
void |
setLabelCount(int count,
boolean force)
sets the number of label entries for the y-axis max = 25, min = 2, default: 6, be aware
that this number is not
fixed (if force == false) and can only be approximated.
|
void |
setSpaceMax(float mSpaceMax)
Sets extra spacing for `axisMaximum` to be added to automatically calculated `axisMaximum`
|
void |
setSpaceMin(float mSpaceMin)
Sets extra spacing for `axisMinimum` to be added to automatically calculated `axisMinimum`
|
void |
setValueFormatter(IAxisValueFormatter f)
Sets the formatter to be used for formatting the axis labels.
|
getTextColor, getTextSize, getTypeface, getXOffset, getYOffset, isEnabled, setEnabled, setTextColor, setTextSize, setTypeface, setXOffset, setYOffsetprotected IAxisValueFormatter mAxisValueFormatter
public float[] mEntries
public float[] mCenteredEntries
public int mEntryCount
public int mDecimals
protected float mGranularity
protected boolean mGranularityEnabled
protected boolean mForceLabels
protected boolean mDrawGridLines
protected boolean mDrawAxisLine
protected boolean mDrawLabels
protected boolean mCenterAxisLabels
protected java.util.List<LimitLine> mLimitLines
protected boolean mDrawLimitLineBehindData
protected boolean mDrawGridLinesBehindData
protected float mSpaceMin
protected float mSpaceMax
protected boolean mCustomAxisMin
protected boolean mCustomAxisMax
public float mAxisMaximum
public float mAxisMinimum
public float mAxisRange
public void setDrawGridLines(boolean enabled)
enabled - public boolean isDrawGridLinesEnabled()
public void setDrawAxisLine(boolean enabled)
enabled - public boolean isDrawAxisLineEnabled()
public void setCenterAxisLabels(boolean enabled)
enabled - public boolean isCenterAxisLabelsEnabled()
public void setGridColor(int color)
color - public int getGridColor()
public void setAxisLineWidth(float width)
width - public float getAxisLineWidth()
public void setGridLineWidth(float width)
width - public float getGridLineWidth()
public void setAxisLineColor(int color)
color - public int getAxisLineColor()
public void setDrawLabels(boolean enabled)
enabled - public boolean isDrawLabelsEnabled()
public void setLabelCount(int count)
count - the number of y-axis labels that should be displayedpublic void setLabelCount(int count,
boolean force)
count - the number of y-axis labels that should be displayedforce - if enabled, the set label count will be forced, meaning that the exact
specified count of labels will
be drawn and evenly distributed alongside the axis - this might cause labels
to have uneven valuespublic boolean isForceLabelsEnabled()
public int getLabelCount()
public boolean isGranularityEnabled()
public void setGranularityEnabled(boolean enabled)
enabled - public float getGranularity()
public void setGranularity(float granularity)
granularity - public void addLimitLine(LimitLine l)
l - public void removeLimitLine(LimitLine l)
l - public void removeAllLimitLines()
public java.util.List<LimitLine> getLimitLines()
public void setDrawLimitLinesBehindData(boolean enabled)
enabled - public boolean isDrawLimitLinesBehindDataEnabled()
public void setDrawGridLinesBehindData(boolean enabled)
enabled - public boolean isDrawGridLinesBehindDataEnabled()
public java.lang.String getLongestLabel()
public java.lang.String getFormattedLabel(int index)
public void setValueFormatter(IAxisValueFormatter f)
f - public IAxisValueFormatter getValueFormatter()
public void enableGridDashedLine(float lineLength,
float spaceLength,
float phase)
lineLength - the length of the line piecesspaceLength - the length of space in between the piecesphase - offset, in degrees (normally, use 0)public void setGridDashedLine(android.graphics.DashPathEffect effect)
effect - the DashPathEffectpublic void disableGridDashedLine()
public boolean isGridDashedLineEnabled()
public android.graphics.DashPathEffect getGridDashPathEffect()
public void enableAxisLineDashedLine(float lineLength,
float spaceLength,
float phase)
lineLength - the length of the line piecesspaceLength - the length of space in between the piecesphase - offset, in degrees (normally, use 0)public void setAxisLineDashedLine(android.graphics.DashPathEffect effect)
effect - the DashPathEffectpublic void disableAxisLineDashedLine()
public boolean isAxisLineDashedLineEnabled()
public android.graphics.DashPathEffect getAxisLineDashPathEffect()
public float getAxisMaximum()
public float getAxisMinimum()
public void resetAxisMaximum()
public boolean isAxisMaxCustom()
public void resetAxisMinimum()
public boolean isAxisMinCustom()
public void setAxisMinimum(float min)
min - @Deprecated public void setAxisMinValue(float min)
min - public void setAxisMaximum(float max)
max - @Deprecated public void setAxisMaxValue(float max)
max - public void calculate(float dataMin,
float dataMax)
dataMin - the min value according to chart datadataMax - the max value according to chart datapublic float getSpaceMin()
public void setSpaceMin(float mSpaceMin)
public float getSpaceMax()
public void setSpaceMax(float mSpaceMax)