makeLine<T> function

Series<LineSeries, T> makeLine<T>(
  1. List<LineSeries> lineData,
  2. bool withColor,
  3. String lastGroup,
  4. int lastAxis,
  5. int lastRender,
)

Implementation

charts.Series<LineSeries, T> makeLine<T>(List<LineSeries> lineData,
    bool withColor, String lastGroup, int lastAxis, int lastRender) {
  charts.Series<LineSeries, T> line;
  if (withColor) {
    line = charts.Series<LineSeries, T>(
        id: lastGroup,
        domainFn: (LineSeries row, _) => row.x,
        measureFn: (LineSeries row, _) => row.y,
        colorFn: (LineSeries row, _) => row.color!,
        labelAccessorFn: (LineSeries row, _) => row.yDisplay!,
        dashPatternFn: (LineSeries row, _) {
          return row.dashPattern;
        },
        data: lineData);
  } else {
    line = charts.Series<LineSeries, T>(
        id: lastGroup,
        domainFn: (LineSeries row, _) => row.x,
        measureFn: (LineSeries row, _) => row.y,
        labelAccessorFn: (LineSeries row, _) => row.yDisplay!,
        dashPatternFn: (LineSeries row, _) {
          return row.dashPattern;
        },
        data: lineData);
  }
  line
    ..setAttribute(
        charts.measureAxisIdKey, lastAxis > 0 ? secondaryMeasureAxisId : null)
    ..setAttribute(
        charts.rendererIdKey, lastRender > 0 ? secondaryMeasureAxisId : null);
  return line;
}