I have an SfCartesianChart (Line-chart), which takes data from a bluetooth device. Works great for around 2/3 minutes. Then it starts plotting the data from the beginning again. Essentially overwriting the chart but leaving the existing data in place.
So rather than a continual left to right set of data points i get a line from the right side of the screen, back to the left about half way through the data reading.
Has anyone experienced this or is anyone able to offer some suggestions?
This is the widget that calls a _ChartData class and gets data from the streambuilder.
widget = Container(
height: 200,
child: SfCartesianChart(
zoomPanBehavior: _zoomPanBehavior,
borderColor: Colors.transparent,
onZoomEnd: (ZoomPanArgs args) {
print(args.currentZoomFactor);
print(args.currentZoomPosition);
},
borderWidth: 0,
primaryYAxis: NumericAxis(
title: AxisTitle(text: 'BPM'),
visibleMinimum: 45,
visibleMaximum: 90,
),
plotAreaBackgroundColor: Colors.transparent,
tooltipBehavior: TooltipBehavior(enable: true),
primaryXAxis: NumericAxis(
isVisible: false,
interval: 20,
// visibleMinimum: 45,
// visibleMaximum: 90,
autoScrollingMode: AutoScrollingMode.start),
series: <LineSeries<_ChartData, int>>[
LineSeries<_ChartData, int>(
color: Colors.red,
onRendererCreated:
(ChartSeriesController controller) {
seriesController = controller;
},
animationDuration: 0,
dataSource: chartData,
xValueMapper: (_ChartData data, _) => data.x,
yValueMapper: (_ChartData data, _) => data.y1),
]),
);```