Series<T, D> constructor

Series<T, D>({
  1. required String id,
  2. required List<T> data,
  3. required TypedAccessorFn<T, D> domainFn,
  4. required TypedAccessorFn<T, num?> measureFn,
  5. String? displayName,
  6. Color? seriesColor,
  7. TypedAccessorFn<T, Color>? areaColorFn,
  8. TypedAccessorFn<T, Color>? colorFn,
  9. TypedAccessorFn<T, List<int>?>? dashPatternFn,
  10. TypedAccessorFn<T, DomainFormatter<D>>? domainFormatterFn,
  11. TypedAccessorFn<T, D?>? domainLowerBoundFn,
  12. TypedAccessorFn<T, D?>? domainUpperBoundFn,
  13. TypedAccessorFn<T, Color?>? fillColorFn,
  14. TypedAccessorFn<T, Color>? patternColorFn,
  15. TypedAccessorFn<T, FillPatternType>? fillPatternFn,
  16. TypedAccessorFn<T, String>? keyFn,
  17. TypedAccessorFn<T, String>? labelAccessorFn,
  18. TypedAccessorFn<T, TextStyleSpec>? insideLabelStyleAccessorFn,
  19. TypedAccessorFn<T, TextStyleSpec>? outsideLabelStyleAccessorFn,
  20. TypedAccessorFn<T, MeasureFormatter>? measureFormatterFn,
  21. TypedAccessorFn<T, num?>? measureLowerBoundFn,
  22. TypedAccessorFn<T, num?>? measureUpperBoundFn,
  23. TypedAccessorFn<T, num>? measureOffsetFn,
  24. bool overlaySeries = false,
  25. TypedAccessorFn<T, num>? radiusPxFn,
  26. String? seriesCategory,
  27. TypedAccessorFn<T, num?>? strokeWidthPxFn,
})

Implementation

factory Series(
    {required String id,
    required List<T> data,
    required TypedAccessorFn<T, D> domainFn,
    required TypedAccessorFn<T, num?> measureFn,
    String? displayName,
    Color? seriesColor,
    TypedAccessorFn<T, Color>? areaColorFn,
    TypedAccessorFn<T, Color>? colorFn,
    TypedAccessorFn<T, List<int>?>? dashPatternFn,
    TypedAccessorFn<T, DomainFormatter<D>>? domainFormatterFn,
    TypedAccessorFn<T, D?>? domainLowerBoundFn,
    TypedAccessorFn<T, D?>? domainUpperBoundFn,
    TypedAccessorFn<T, Color?>? fillColorFn,
    TypedAccessorFn<T, Color>? patternColorFn,
    TypedAccessorFn<T, FillPatternType>? fillPatternFn,
    TypedAccessorFn<T, String>? keyFn,
    TypedAccessorFn<T, String>? labelAccessorFn,
    TypedAccessorFn<T, TextStyleSpec>? insideLabelStyleAccessorFn,
    TypedAccessorFn<T, TextStyleSpec>? outsideLabelStyleAccessorFn,
    TypedAccessorFn<T, MeasureFormatter>? measureFormatterFn,
    TypedAccessorFn<T, num?>? measureLowerBoundFn,
    TypedAccessorFn<T, num?>? measureUpperBoundFn,
    TypedAccessorFn<T, num>? measureOffsetFn,
    bool overlaySeries = false,
    TypedAccessorFn<T, num>? radiusPxFn,
    String? seriesCategory,
    TypedAccessorFn<T, num?>? strokeWidthPxFn}) {
  // Wrap typed accessors.
  final _domainFn = (int? index) => domainFn(data[index!], index);
  final _measureFn = (int? index) => measureFn(data[index!], index);
  final _areaColorFn = areaColorFn == null
      ? null
      : (int? index) => areaColorFn(data[index!], index);
  final _colorFn =
      colorFn == null ? null : (int? index) => colorFn(data[index!], index);
  final _dashPatternFn = dashPatternFn == null
      ? null
      : (int? index) => dashPatternFn(data[index!], index);
  final _domainFormatterFn = domainFormatterFn == null
      ? null
      : (int? index) => domainFormatterFn(data[index!], index);
  final _domainLowerBoundFn = domainLowerBoundFn == null
      ? null
      : (int? index) => domainLowerBoundFn(data[index!], index);
  final _domainUpperBoundFn = domainUpperBoundFn == null
      ? null
      : (int? index) => domainUpperBoundFn(data[index!], index);
  final _fillColorFn = fillColorFn == null
      ? null
      : (int? index) => fillColorFn(data[index!], index);
  final _patternColorFn = patternColorFn == null
      ? null
      : (int? index) => patternColorFn(data[index!], index);
  final _fillPatternFn = fillPatternFn == null
      ? null
      : (int? index) => fillPatternFn(data[index!], index);
  final _labelAccessorFn = labelAccessorFn == null
      ? null
      : (int? index) => labelAccessorFn(data[index!], index);
  final _insideLabelStyleAccessorFn = insideLabelStyleAccessorFn == null
      ? null
      : (int? index) => insideLabelStyleAccessorFn(data[index!], index);
  final _outsideLabelStyleAccessorFn = outsideLabelStyleAccessorFn == null
      ? null
      : (int? index) => outsideLabelStyleAccessorFn(data[index!], index);
  final _measureFormatterFn = measureFormatterFn == null
      ? null
      : (int? index) => measureFormatterFn(data[index!], index);
  final _measureLowerBoundFn = measureLowerBoundFn == null
      ? null
      : (int? index) => measureLowerBoundFn(data[index!], index);
  final _measureUpperBoundFn = measureUpperBoundFn == null
      ? null
      : (int? index) => measureUpperBoundFn(data[index!], index);
  final _measureOffsetFn = measureOffsetFn == null
      ? null
      : (int? index) => measureOffsetFn(data[index!], index);
  final _radiusPxFn = radiusPxFn == null
      ? null
      : (int? index) => radiusPxFn(data[index!], index);
  final _strokeWidthPxFn = strokeWidthPxFn == null
      ? null
      : (int? index) => strokeWidthPxFn(data[index!], index);
  final _keyFn =
      keyFn == null ? null : (int? index) => keyFn(data[index!], index);

  return Series._internal(
    id: id,
    data: data,
    domainFn: _domainFn,
    measureFn: _measureFn,
    displayName: displayName,
    areaColorFn: _areaColorFn,
    colorFn: _colorFn,
    dashPatternFn: _dashPatternFn,
    domainFormatterFn: _domainFormatterFn,
    domainLowerBoundFn: _domainLowerBoundFn,
    domainUpperBoundFn: _domainUpperBoundFn,
    fillColorFn: _fillColorFn,
    fillPatternFn: _fillPatternFn,
    keyFn: _keyFn,
    patternColorFn: _patternColorFn,
    labelAccessorFn: _labelAccessorFn,
    insideLabelStyleAccessorFn: _insideLabelStyleAccessorFn,
    outsideLabelStyleAccessorFn: _outsideLabelStyleAccessorFn,
    measureFormatterFn: _measureFormatterFn,
    measureLowerBoundFn: _measureLowerBoundFn,
    measureUpperBoundFn: _measureUpperBoundFn,
    measureOffsetFn: _measureOffsetFn,
    overlaySeries: overlaySeries,
    radiusPxFn: _radiusPxFn,
    seriesCategory: seriesCategory,
    seriesColor: seriesColor,
    strokeWidthPxFn: _strokeWidthPxFn,
  );
}