SwiftTimeChart constructor
SwiftTimeChart({
- required HTMLDivElement container,
- required List<
TimeChartSeries> series, - FontFace? font,
- int fontSize = 10,
- String textColor = '#333',
- TimeChartDateDisplay dateDisplay = TimeChartDateDisplay.local,
- int margin = 5,
- int textMargin = 10,
- TimeChartDateFormatter? dateFormatter,
- String gridColor = '#e5e5e5',
- bool showGrid = true,
- bool highlightCurrentInterval = false,
- bool showTip = true,
- bool showTimeScale = true,
- bool showValueScale = true,
- bool rotateTimeLabels = true,
- 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();
}