forked from PhilJay/MPAndroidChart
-
Notifications
You must be signed in to change notification settings - Fork 0
DataSet classes in detail
Philipp Jahoda edited this page Mar 29, 2015
·
20 revisions
This wiki entry focuses on the subclasses of the DataSet class.
All other subclasses of DataSet not mentioned here do not provide any specific enhancements.
Line-, Bar-, Scatter- & CandleDataSet (below mentioned methods can be used for any of the mentioned DataSet classes)
-
setHighLightColor(int color): Sets the color that is used for drawing the highlight indicators. Don't forget to resolve the color usinggetResources().getColor(...)orColor.rgb(...)(or simplyColor.BLACK).
Line- & RadarDataSet (methods only for LineDataSet and RadarDataSet)
-
setFillColor(int color): Sets the color that is used for filling the line surface. -
setFillAlpha(int alpha): Sets the alpha value (transparency) that is used for filling the line surface (0-255), default: 85, 255 = fully opaque, 0 = fully transparent -
setDrawFilled(boolean filled): Set to true if the DataSet should be drawn filled (surface, area), and not just as a line, disabling this will give great performance boost! default: false -
setLineWidth(float width): Set the line width for this DataSet (min = 0.2f, max = 10f); default 1f NOTE: thinner line == better performance, thicker line == worse performance
Below mentioned methods are only applicable for the specifically mentioned DataSet subclass.
LineDataSet (class LineDataSet)
-
setCircleSize(float size): Sets the size (radius) of the circle shaped value indicators, default size = 4f -
setDrawCircles(boolean enabled): Set this to true to enable the drawing of circle indicators for thisLineDataSet, default true -
setDrawCubic(boolean enabled): If set to true, the linechart lines are drawn in cubic-style instead of linear. This has a negative effect on performance! Default: false -
setCubicIntensity(float intensity): Sets the intensity for cubic lines (if enabled). Max = 1f = very cubic, Min = 0.05f = low cubic effect, Default: 0.2f -
setCircleColor(int color): Sets the color all circle indicators of this dataset should have. -
setCircleColors(List colors): Sets the colors the outer-circles of thisLineDataSetshould have. There are various other methods for setting circle colors as well. -
setCircleColorHole(int color): Sets the color of the inner circle of the line-circles (the hole). -
setDrawCircleHole(boolean enabled): Set this to true to allow drawing a hole in each circle of this dataset. If set to false, circles will be drawn filled (without hole). -
enableDashedLine(float lineLength, float spaceLength, float phase): Enables the line to be drawn in dashed mode, e.g. like this "- - - - - -". "lineLength" is the length of the line pieces, "spaceLength" is the length of space in between the pieces, "phase" is the offset, in degrees (normally, use 0)
BarDataSet (class BarDataSet)
-
setBarSpacePercent(float percent): Sets the space between the bars in percent of the total bar width. -
setBarShadowColor(int color): Sets the color used for drawing the bar-shadows. The bar shadows is a surface behind the bar that indicates the maximum value. Don't for get to usegetResources().getColor(...)to set this. OrColor.rgb(...). -
setHighLightAlpha(int alpha): Set the alpha value (transparency) that is used for drawing the highlight indicator bar. min = 0 (fully transparent), max = 255 (fully opaque). -
setStackLabels(String[] labels): Sets labels for different values of bar-stacks, in case there are one.
ScatterDataSet (class ScatterDataSet)
-
setScatterShapeSize(float size): Sets the size in density pixels the drawn scattershape will have. This only applies for non custom shapes. -
setScatterShape(ScatterShape shape): Sets the shape that is drawn on the position where the values are at.
CandleDataSet (class CandleDataSet)
-
setBodySpace(float space): Sets the space that is left out on the left and right side of each candle body, default 0.1f (10%), max 0.45f, min 0f -
setShadowWidth(float width): Sets the width of the candle-shadow-line in dp. Default 3f.
PieDataSet (class PieDataSet)
-
setSliceSpace(float degrees): Sets the space that is left out between the piechart-slices, default: 0° --> no space, maximum 45, minimum 0 (no space) -
setSelectionShift(float shift): Sets the distance the highlighted piechart-slice of this DataSet is "shifted" away from the center of the chart, default 12f