renderTimeSeriesChart method

  1. @override
RenderedChartJS renderTimeSeriesChart(
  1. Element output,
  2. ChartTimeSeries chartData
)
override

Renders a Time Series using Line Chart:

Implementation

@override
RenderedChartJS renderTimeSeriesChart(
    Element output, ChartTimeSeries chartData) {
  checkRenderParameters(output, chartData);
  checkLoaded();

  var canvas = asCanvasElement(output);

  var timeSeries = chartData.seriesAsPairsOfMap(
      sortSeriesByCategory: chartData.options.sortCategories,
      mapDateTimeToMillis: true);

  chartData.ensureColors(colorGenerator);

  var colors = chartData.colors!;

  var renderArgs = [
    canvas,
    chartData.title,
    chartData.xTitle,
    chartData.yTitle,
    _xAxisMinMax(chartData),
    _yAxisMinMax(chartData),
    JsObject.jsify(timeSeries),
    _verticalLinesConfig(chartData),
    JsObject.jsify(colors),
    chartData.options.fillLines,
    chartData.options.straightLines,
    chartData.options.steppedLines,
    _onClick(chartData)
  ];

  var chartObject = _jsWrapper!.callMethod('renderTimeSeries', renderArgs);

  return RenderedChartJS(this, 'time-series', chartObject, chartData);
}