Series<T, D> constructor
Series<T, D> ({
- 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< ? dashPatternFn,int> ?> - TypedAccessorFn<
T, DomainFormatter< ? domainFormatterFn,D> > - 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,
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,
);
}