In chapter the getting started and general styling chapters, general chart settings and styling methods applicable for all chart types were mentioned. This chapter focuses on specific settings for the individual chart types.

Line-, Bar-, Scatter-, Candle- & BubbleChart

  • setAutoScaleMinMaxEnabled(boolean enabled): Flag that indicates if auto scaling on the y axis is enabled. If enabled the y axis automatically adjusts to the min and max y values of the current x axis range whenever the viewport changes. This is especially interesting for charts displaying financial data. Default: false
  • setKeepPositionOnRotation(boolean enabled): Sets wether the chart should keep its position (zoom / scroll) after orientation change. Default: false

BarChart

  • setDrawValueAboveBar(boolean enabled): If set to true, all values are drawn above their bars, instead of below their top.
  • setDrawBarShadow(boolean enabled): If set to true, a grey area is drawn behind each bar that indicates the maximum value. Enabling his will reduce performance by about 40%.
  • setDrawValuesForWholeStack(boolean enabled): If set to true, all values of stacked bars are drawn individually, and not just their sum on top of all.
  • setDrawHighlightArrow(boolean enabled): Set this to true to draw the highlightning arrow above each bar when highlighted.

PieChart

  • setDrawSliceText(boolean enabled): Set this to true to draw the x-value text into the pie slices.
  • setUsePercentValues(boolean enabled): If this is enabled, values inside the chart are drawn in percent and not with their original value. Values provided for the ValueFormatter to format are then provided in percent.
  • setCenterText(SpannableString text): Sets the text that is drawn in the center of the PieChart. Longer text will be automatically “wrapped” to avoid clipping into the pie-slices.
  • setCenterTextRadiusPercent(float percent): Sets the rectangular radius of the bounding box for the center text, as a percentage of the pie hole default 1.f (100%).
  • setHoleRadius(float percent): Sets the radius of the hole in the center of the piechart in percent of the maximum radius (max = the radius of the whole chart), default 50%
  • setTransparentCircleRadius(float percent): Sets the radius of the transparent circle that is drawn next to the hole in the piechart in percent of the maximum radius (max = the radius of the whole chart), default 55% -> means 5% larger than the center-hole by default
  • setTransparentCircleColor(int color): Sets the color of the transparent circle.
  • setTransparentCircleAlpha(int alpha): Sets the amount of transparency (0-255) the transparent circle should have.
  • setMaxAngle(float maxangle): Sets the max angle that is used for calculating the pie-circle. 360f means it’s a full PieChart, 180f results in a half-pie-chart. Default: 360f

RadarChart

  • setSkipWebLineCount(int count): Allows to skip web lines coming from the center of the chart. Especially useful if there are a lot of lines.