getDataBounds method

  1. @protected
void getDataBounds(
  1. double getValue(
    1. ChartDataPoint
    ),
  2. double combine(
    1. double,
    2. double
    )
)

Get data bounds (to be overridden by subclasses).

This method is a placeholder for subclasses to implement custom bounds calculation logic. The default implementation does nothing.

Parameters:

  • getValue - Function to extract a value from a data point
  • combine - Function to combine two values (e.g., min or max)

Example Implementation

@override
void getDataBounds(
  double Function(ChartDataPoint) getValue,
  double Function(double, double) combine,
) {
  double result = getValue(dataSets.first.dataPoint);
  for (final dataSet in dataSets) {
    final point = dataSet.dataPoint;
    result = combine(result, getValue(point));
    }
  }
  // Store result...
}

Implementation

@protected
void getDataBounds(
  double Function(ChartDataPoint) getValue,
  double Function(double, double) combine,
) {
  // This will be overridden by subclasses
}