groupBars method

void groupBars(
  1. double fromX,
  2. double groupSpace,
  3. double barSpace
)

Groups all BarDataSet objects this data object holds together by modifying the x-value of their entries. Previously set x-values of entries will be overwritten. Leaves space between bars and groups as specified by the parameters. Calls notifyDataSetChanged() afterwards.

@param fromX the starting point on the x-axis where the grouping should begin @param groupSpace the space between groups of bars in values (not pixels) e.g. 0.8f for bar width 1f @param barSpace the space between individual bars in values (not pixels) e.g. 0.1f for bar width 1f

Implementation

void groupBars(double fromX, double groupSpace, double barSpace) {
  if (getBarData() == null) {
    throw Exception(
        "You need to set data for the chart before grouping bars.");
  } else {
    getBarData()!.groupBars(fromX, groupSpace, barSpace);
  }
}