groupBars method

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

Places the bars of all data sets side by side in groups, one group per x position, then refreshes the chart. Delegates to BarData.groupBars, which also changes the bar width and entry x values.

fromX is the x value where the first group starts, groupSpace the space between two groups and barSpace the space between two bars inside a group, both in x units.

Throws a StateError when no data has been set.

Implementation

void groupBars(double fromX, double groupSpace, double barSpace) {
  final barData = this.barData;
  if (barData == null) {
    throw StateError(
      'You need to set data for the chart before grouping bars.',
    );
  }
  barData.groupBars(fromX, groupSpace, barSpace);
  notifyDataSetChanged();
}