ChartLine.withChartData constructor

ChartLine.withChartData(
  1. List data, {
  2. bool animate = false,
  3. double height = 200.0,
  4. int titleFontSize = 14,
  5. double maskFontSize = 18.0,
  6. bool showLegend = true,
  7. bool showChartTitle = true,
  8. bool showAxisLine = false,
  9. Widget? loadingWidget,
  10. double strokeWidth = 1.0,
  11. bool hidePrimaryAxis = false,
  12. TypedHiddenFn<String, bool>? hiddenFn,
  13. bool hideSecondaryAxis = false,
  14. bool hideDomainAxis = false,
})

Implementation

factory ChartLine.withChartData(List data,
    {bool animate = false,
    double height = 200.0,
    int titleFontSize = 14,
    double maskFontSize = 18.0,
    bool showLegend = true,
    bool showChartTitle = true,
    bool showAxisLine = false,
    Widget? loadingWidget,
    double strokeWidth = 1.0,
    bool hidePrimaryAxis = false,
    TypedHiddenFn<String, bool>? hiddenFn,
    bool hideSecondaryAxis = false,
    bool hideDomainAxis = false}) {
  var lineData =
      data.map<ChartLineData>((e) => ChartLineData.fromJson(e)).toList();
  List<charts.TickSpec<String>> staticTick = _makeStaticTick(lineData);
  return ChartLine(
    staticTicks: staticTick,
    lineData: lineData,
    animate: animate,
    height: height,
    titleFontSize: titleFontSize,
    maskFontSize: maskFontSize,
    showLegend: showLegend,
    showChartTitle: showChartTitle,
    showAxisLine: showAxisLine,
    loadingWidget: loadingWidget,
    hiddenFn:
        hiddenFn == null ? null : (String? groupCode) => hiddenFn(groupCode!),
    strokeWidth: strokeWidth,
    hideDomainAxis: hideDomainAxis,
    hidePrimaryAxis: hidePrimaryAxis,
    hideSecondaryAxis: hideSecondaryAxis,
  );
}