MutableSeries<D> constructor

MutableSeries<D>(
  1. Series<dynamic, D> series
)

Implementation

MutableSeries(Series<dynamic, D> series)
    : id = series.id,
      displayName = series.displayName ?? series.id,
      overlaySeries = series.overlaySeries,
      seriesCategory = series.seriesCategory,
      seriesColor = series.seriesColor,
      data = series.data,
      keyFn = series.keyFn,
      domainFn = series.domainFn,
      domainFormatterFn = series.domainFormatterFn,
      domainLowerBoundFn = series.domainLowerBoundFn,
      domainUpperBoundFn = series.domainUpperBoundFn,
      measureFn = series.measureFn,
      measureFormatterFn = series.measureFormatterFn,
      measureLowerBoundFn = series.measureLowerBoundFn,
      measureUpperBoundFn = series.measureUpperBoundFn,
      measureOffsetFn = series.measureOffsetFn,

      // Save the original measure functions in case they get replaced later.
      rawMeasureFn = series.measureFn,
      rawMeasureLowerBoundFn = series.measureLowerBoundFn,
      rawMeasureUpperBoundFn = series.measureUpperBoundFn,
      areaColorFn = series.areaColorFn,
      colorFn = series.colorFn,
      dashPatternFn = series.dashPatternFn,
      fillColorFn = series.fillColorFn,
      fillPatternFn = series.fillPatternFn,
      patternColorFn = series.patternColorFn,
      insideLabelStyleAccessorFn = series.insideLabelStyleAccessorFn,
      outsideLabelStyleAccessorFn = series.outsideLabelStyleAccessorFn,
      radiusPxFn = series.radiusPxFn,
      strokeWidthPxFn = series.strokeWidthPxFn {
  // Pre-compute the sum of the measure values to make it available on demand.
  seriesMeasureTotal = 0;
  for (var i = 0; i < data.length; i++) {
    final measure = measureFn(i);
    if (measure != null) {
      seriesMeasureTotal += measure;
    }
  }

  labelAccessorFn = series.labelAccessorFn ?? (i) => domainFn(i).toString();

  _attrs.mergeFrom(series.attributes);
}