addMeasureValuesFor method

void addMeasureValuesFor(
  1. MutableSeries<D> series,
  2. Axis<num> measureAxis,
  3. int startIndex,
  4. int endIndex,
)

Implementation

void addMeasureValuesFor(
  MutableSeries<D> series,
  Axis<num> measureAxis,
  int startIndex,
  int endIndex,
) {
  final measureFn = series.measureFn;
  final measureOffsetFn = series.measureOffsetFn!;
  final measureLowerBoundFn = series.measureLowerBoundFn;
  final measureUpperBoundFn = series.measureUpperBoundFn;

  for (var i = startIndex; i <= endIndex; i++) {
    final measure = measureFn(i);
    final measureOffset = measureOffsetFn(i);

    if (measure != null && measureOffset != null) {
      measureAxis.addDomainValue(measure + measureOffset);

      if (measureLowerBoundFn != null && measureUpperBoundFn != null) {
        measureAxis
            .addDomainValue((measureLowerBoundFn(i) ?? 0) + measureOffset);
        measureAxis
            .addDomainValue((measureUpperBoundFn(i) ?? 0) + measureOffset);
      }
    }
  }
}