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-, Bubble- & 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 using getResources().getColor(...) or Color.rgb(...) (or simply Color.BLACK).

Line-, Bar-, Scatter-, Candle- & RadarDataSet

  • setDrawHighlightIndicators(boolean enabled): Enables / disables both vertical and horizontal highlight indicator lines. Call setDrawVerticalHighlightIndicator(...) and setDrawHorizontalHighlightIndicator(...) for individual configuration.
  • setHighlightLineWidth(float width): Sets the width of the highlight lines (crosshairs) in dp.

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
  • setFillDrawable(Drawable d): Sets a Drawable that should cover the fill-area. This also allows to use gradients.
  • 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 a performance boost. Please note that this method uses the canvas.clipPath(...) method for drawing the filled area. For devices with API level < 18 (Android 4.3), hardware acceleration of the chart should be turned off – see here. 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)

  • setCircleRadius(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 this LineDataSet, 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<Integer> colors): Sets the colors the outer-circles of this LineDataSet should 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 use getResources().getColor(...) to set this. Or Color.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.
  • setShadowColor(int color): Sets the color of the candle-shadow-line.
  • setDecreasingColor(int color): Sets the one and ONLY color that should be used for this DataSet when open > close.
  • setIncreasingColor(int color): Sets the one and ONLY color that should be used for this DataSet when open <= close.
  • setDecreasingPaintStyle(Paint.Style style): Sets paint style when open > close (fill or stroke).
  • setIncreasingPaintStyle(Paint.Style style): Sets paint style when open <= close (fill or stroke).

BubbleDataSet (class BubbleDataSet)

  • setHighlightCircleWidth(float width): Sets the width of the circle that surrounds the bubble when in highlighted state, in dp.

Information concerning CandleDataSet colors: The usual setColors(...), setColor(...), … methods can still be used for coloring the chart all at once. If specific colors (for body, shadow, …) are needed, use the above mentioned methods.

PieDataSet (class PieDataSet)

  • setSliceSpace(float degrees): Sets the space that is left out between the piechart-slices in dp, default: 0 –> no space, maximum 20, 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