SwiftTimeChart constructor

SwiftTimeChart({
  1. required HTMLDivElement container,
  2. required List<TimeChartSeries> series,
  3. FontFace? font,
  4. int fontSize = 10,
  5. String textColor = '#333',
  6. TimeChartDateDisplay dateDisplay = TimeChartDateDisplay.local,
  7. int margin = 5,
  8. int textMargin = 10,
  9. TimeChartDateFormatter? dateFormatter,
  10. String gridColor = '#e5e5e5',
  11. bool showGrid = true,
  12. bool highlightCurrentInterval = false,
  13. bool showTip = true,
  14. bool showTimeScale = true,
  15. bool showValueScale = true,
  16. bool rotateTimeLabels = true,
  17. double? forcePadding,
})

Implementation

SwiftTimeChart(
    {required this.container,
    required this.series,
    this.font,
    this.fontSize = 10,
    this.textColor = '#333',
    this.dateDisplay = TimeChartDateDisplay.local,
    this.margin = 5,
    this.textMargin = 10,
    this.dateFormatter,
    this.gridColor = '#e5e5e5',
    this.showGrid = true,
    this.highlightCurrentInterval = false,
    this.showTip = true,
    this.showTimeScale = true,
    this.showValueScale = true,
    this.rotateTimeLabels = true,
    this.forcePadding})
    : canvas = HTMLCanvasElement(),
      canvasTip = HTMLDivElement() {
  container.innerHTML = ''.toJS;
  container.className += ' swift-chart time-chart';
  container.append(canvas);
  canvas.onMouseMove.listen(handleMouseMove);
  container.onMouseLeave.listen(handleMouseLeave);
  renderMessage('rendering...');
  container.append(canvasTip);
  canvasTip.className = 'tooltip';
  canvasTip.style.display = 'none';
  SwiftChart.ensureStyles();
  initObserver();
  for (final s in series) {
    s._notify = _scheduleRender;
  }
  render();
}