-
public class LimitLine extends ComponentBase
The limit line is an additional feature for all Line-, Bar- and ScatterCharts. It allows the displaying of an additional line in the chart that marks a certain maximum / limit on the specified axis (x- or y-axis).
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description public enumLimitLine.LimitLabelPositionenum that indicates the position of the LimitLine label
-
Method Summary
Modifier and Type Method Description floatgetLimit()Returns the limit that is set for this line. voidsetLineWidth(float width)set the line width of the chart (min = 0. floatgetLineWidth()returns the width of limit line voidsetLineColor(int color)Sets the linecolor for this LimitLine. intgetLineColor()Returns the color that is used for this LimitLine voidenableDashedLine(float lineLength, float spaceLength, float phase)Enables the line to be drawn in dashed mode, e.g. voiddisableDashedLine()Disables the line to be drawn in dashed mode. booleanisDashedLineEnabled()Returns true if the dashed-line effect is enabled, false if not. DashPathEffectgetDashPathEffect()returns the DashPathEffect that is set for this LimitLine voidsetTextStyle(Paint.Style style)Sets the color of the value-text that is drawn next to the LimitLine.Default: Paint.Style. Paint.StylegetTextStyle()Returns the color of the value-text that is drawn next to the LimitLine. voidsetLabelPosition(LimitLine.LimitLabelPosition pos)Sets the position of the LimitLine value label (either on the right or onthe left edge of the chart). LimitLine.LimitLabelPositiongetLabelPosition()Returns the position of the LimitLine label (value). voidsetLabel(String label)Sets the label that is drawn next to the limit line. StringgetLabel()Returns the label that is drawn next to the limit line. -
Methods inherited from class com.github.mikephil.charting.components.ComponentBase
getTextColor, getTextSize, getTypeface, getXOffset, getYOffset, isEnabled, setEnabled, setTextColor, setTextSize, setTypeface, setXOffset, setYOffset -
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
-
Constructor Detail
-
LimitLine
LimitLine(float limit)
Constructor with limit.- Parameters:
limit- - the position (the value) on the y-axis (y-value) or x-axis(xIndex) where this line should appear
-
LimitLine
LimitLine(float limit, String label)
Constructor with limit and label.- Parameters:
limit- - the position (the value) on the y-axis (y-value) or x-axis(xIndex) where this line should appearlabel- - provide "" if no label is required
-
-
Method Detail
-
getLimit
float getLimit()
Returns the limit that is set for this line.
-
setLineWidth
void setLineWidth(float width)
set the line width of the chart (min = 0.2f, max = 12f); default 2f NOTE:thinner line == better performance, thicker line == worse performance
-
getLineWidth
float getLineWidth()
returns the width of limit line
-
setLineColor
void setLineColor(int color)
Sets the linecolor for this LimitLine. Make sure to usegetResources().getColor(...)
-
getLineColor
int getLineColor()
Returns the color that is used for this LimitLine
-
enableDashedLine
void enableDashedLine(float lineLength, float spaceLength, float phase)
Enables the line to be drawn in dashed mode, e.g. like this "- - - - - -"
- Parameters:
lineLength- the length of the line piecesspaceLength- the length of space inbetween the piecesphase- offset, in degrees (normally, use 0)
-
disableDashedLine
void disableDashedLine()
Disables the line to be drawn in dashed mode.
-
isDashedLineEnabled
boolean isDashedLineEnabled()
Returns true if the dashed-line effect is enabled, false if not. Default:disabled
-
getDashPathEffect
DashPathEffect getDashPathEffect()
returns the DashPathEffect that is set for this LimitLine
-
setTextStyle
void setTextStyle(Paint.Style style)
Sets the color of the value-text that is drawn next to the LimitLine.Default: Paint.Style.FILL_AND_STROKE
-
getTextStyle
Paint.Style getTextStyle()
Returns the color of the value-text that is drawn next to the LimitLine.
-
setLabelPosition
void setLabelPosition(LimitLine.LimitLabelPosition pos)
Sets the position of the LimitLine value label (either on the right or onthe left edge of the chart). Not supported for RadarChart.
-
getLabelPosition
LimitLine.LimitLabelPosition getLabelPosition()
Returns the position of the LimitLine label (value).
-
setLabel
void setLabel(String label)
Sets the label that is drawn next to the limit line. Provide "" if nolabel is required.
-
-
-
-