Adding dataLabels will throw an exception when using ChartSeriesController to update the chart #1930
Labels
charts
Charts component
fixed
Fixed and delivered update
waiting for customer response
Cannot make further progress until the customer responds.
Bug description
Version: 26.1.35
We are using the ChartSeriesController to update the chart data.
Everything works fine until we set the builder in the DataLabelSettings, which throws an exception with a message: ‘RangeError (length): Invalid value: Valid value range is empty: 0’.
Steps to reproduce
List<LineSeries<ChartSampleData, num>> _getAddRemovePointSeries() { return <LineSeries<ChartSampleData, num>>[ LineSeries<ChartSampleData, num>( onRendererCreated: (ChartSeriesController<ChartSampleData, num> controller) { _chartSeriesController = controller; }, dataLabelSettings: DataLabelSettings( isVisible: true, builder: (dynamic data, dynamic point, dynamic series, int pointIndex, int seriesIndex) { return Text( '${data.y}', style: TextStyle(color: Colors.white), ); }, ), animationDuration: 0, dataSource: chartData, xValueMapper: (ChartSampleData sales, _) => sales.x as num, yValueMapper: (ChartSampleData sales, _) => sales.y), ]; }
Code sample
Code sample
Screenshots or Video
Screenshots / Video demonstration
[Upload media here]
20240618-061609.mp4
Stack Traces
Stack Traces
The text was updated successfully, but these errors were encountered: