public class YAxis extends AxisBase
| Modifier and Type | Class and Description |
|---|---|
static class |
YAxis.AxisDependency
Enum that specifies the axis a DataSet should be plotted against, either LEFT or RIGHT.
|
static class |
YAxis.YAxisLabelPosition
enum for the position of the y-labels relative to the chart
|
| Modifier and Type | Field and Description |
|---|---|
float |
mAxisMaximum |
float |
mAxisMinimum |
float |
mAxisRange
the total range of values this axis covers
|
protected float |
mCustomAxisMax
custom maximum value this axis represents
|
protected float |
mCustomAxisMin
custom minimum value this axis represents
|
int |
mDecimals
the number of decimal digits to use
|
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 boolean |
mInverted
flag that indicates if the axis is inverted or not
|
protected boolean |
mShowOnlyMinMax
if true, the y-labels show only the minimum and maximum value
|
protected float |
mSpacePercentBottom
axis space from the smallest value to the bottom in percent of the total axis range
|
protected float |
mSpacePercentTop
axis space from the largest value to the top in percent of the total axis range
|
protected boolean |
mStartAtZero
if true, the y-label entries will always start at zero
|
protected YAxisValueFormatter |
mYAxisValueFormatter
custom formatter that is used instead of the auto-formatter if set
|
mDrawAxisLine, mDrawGridLines, mDrawLabels, mDrawLimitLineBehindData, mLimitLinesmEnabled, mTextColor, mTextSize, mTypeface, mXOffset, mYOffset| Constructor and Description |
|---|
YAxis() |
YAxis(YAxis.AxisDependency position) |
| Modifier and Type | Method and Description |
|---|---|
YAxis.AxisDependency |
getAxisDependency() |
float |
getAxisMaxValue() |
float |
getAxisMinValue() |
java.lang.String |
getFormattedLabel(int index)
Returns the formatted y-label at the specified index.
|
int |
getLabelCount()
Returns the number of label entries the y-axis should have
|
YAxis.YAxisLabelPosition |
getLabelPosition()
returns the position of the y-labels
|
java.lang.String |
getLongestLabel()
Returns the longest formatted label (in terms of characters), this axis
contains.
|
float |
getRequiredHeightSpace(android.graphics.Paint p) |
float |
getRequiredWidthSpace(android.graphics.Paint p) |
float |
getSpaceBottom()
Returns the bottom axis space in percent of the full range.
|
float |
getSpaceTop()
Returns the top axis space in percent of the full range.
|
YAxisValueFormatter |
getValueFormatter()
Returns the formatter used for formatting the axis labels.
|
boolean |
isDrawTopYLabelEntryEnabled()
returns true if drawing the top y-axis label entry is enabled
|
boolean |
isForceLabelsEnabled()
Returns true if focing the y-label count is enabled.
|
boolean |
isInverted()
If this returns true, the y-axis is inverted.
|
boolean |
isShowOnlyMinMaxEnabled()
Returns true if showing only min and max value is enabled.
|
boolean |
isStartAtZeroEnabled()
returns true if the chart is set to start at zero, false otherwise
|
boolean |
needsDefaultFormatter()
If this component has no YAxisValueFormatter or is only equipped with the default one (no custom set), return true.
|
boolean |
needsOffset()
Returns true if this axis needs horizontal offset, false if no offset is needed.
|
void |
resetAxisMaxValue()
By calling this method, any custom maximum value that has been previously set is reseted, and the calculation is
done automatically.
|
void |
resetAxisMinValue()
By calling this method, any custom minimum value that has been previously set is reseted, and the calculation is
done automatically.
|
void |
setAxisMaxValue(float max)
Set a custom maximum value for this axis.
|
void |
setAxisMinValue(float min)
Set a custom minimum value for this axis.
|
void |
setDrawTopYLabelEntry(boolean enabled)
set this to true to enable drawing the top y-label entry.
|
void |
setInverted(boolean enabled)
If this is set to true, the y-axis is inverted which means that low values are on top of the chart, high values
on bottom.
|
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 |
setPosition(YAxis.YAxisLabelPosition pos)
sets the position of the y-labels
|
void |
setShowOnlyMinMax(boolean enabled)
If enabled, the YLabels will only show the minimum and maximum value of the chart.
|
void |
setSpaceBottom(float percent)
Sets the bottom axis space in percent of the full range.
|
void |
setSpaceTop(float percent)
Sets the top axis space in percent of the full range.
|
void |
setStartAtZero(boolean enabled)
enable this to force the y-axis labels to always start at zero
|
void |
setValueFormatter(YAxisValueFormatter f)
Sets the formatter to be used for formatting the axis labels.
|
addLimitLine, disableGridDashedLine, enableGridDashedLine, getAxisLineColor, getAxisLineWidth, getGridColor, getGridDashPathEffect, getGridLineWidth, getLimitLines, isDrawAxisLineEnabled, isDrawGridLinesEnabled, isDrawLabelsEnabled, isDrawLimitLinesBehindDataEnabled, isGridDashedLineEnabled, removeAllLimitLines, removeLimitLine, setAxisLineColor, setAxisLineWidth, setDrawAxisLine, setDrawGridLines, setDrawLabels, setDrawLimitLinesBehindData, setGridColor, setGridLineWidthgetTextColor, getTextSize, getTypeface, getXOffset, getYOffset, isEnabled, setEnabled, setTextColor, setTextSize, setTypeface, setXOffset, setYOffsetprotected YAxisValueFormatter mYAxisValueFormatter
public float[] mEntries
public int mEntryCount
public int mDecimals
protected boolean mShowOnlyMinMax
protected boolean mInverted
protected boolean mStartAtZero
protected boolean mForceLabels
protected float mCustomAxisMin
protected float mCustomAxisMax
protected float mSpacePercentTop
protected float mSpacePercentBottom
public float mAxisMaximum
public float mAxisMinimum
public float mAxisRange
public YAxis()
public YAxis(YAxis.AxisDependency position)
public YAxis.AxisDependency getAxisDependency()
public YAxis.YAxisLabelPosition getLabelPosition()
public void setPosition(YAxis.YAxisLabelPosition pos)
pos - public boolean isDrawTopYLabelEntryEnabled()
public void setDrawTopYLabelEntry(boolean enabled)
enabled - public void setLabelCount(int count,
boolean force)
count - the number of y-axis labels that sould 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 int getLabelCount()
public boolean isForceLabelsEnabled()
public void setShowOnlyMinMax(boolean enabled)
enabled - public boolean isShowOnlyMinMaxEnabled()
public void setInverted(boolean enabled)
enabled - public boolean isInverted()
public void setStartAtZero(boolean enabled)
enabled - public boolean isStartAtZeroEnabled()
public float getAxisMinValue()
public void setAxisMinValue(float min)
min - public void resetAxisMinValue()
public float getAxisMaxValue()
public void setAxisMaxValue(float max)
max - public void resetAxisMaxValue()
public void setSpaceTop(float percent)
percent - public float getSpaceTop()
public void setSpaceBottom(float percent)
percent - public float getSpaceBottom()
public float getRequiredWidthSpace(android.graphics.Paint p)
public float getRequiredHeightSpace(android.graphics.Paint p)
public java.lang.String getLongestLabel()
AxisBasegetLongestLabel in class AxisBasepublic java.lang.String getFormattedLabel(int index)
index - public void setValueFormatter(YAxisValueFormatter f)
f - public YAxisValueFormatter getValueFormatter()
public boolean needsDefaultFormatter()
public boolean needsOffset()