The error message says "UnsupportedError (Unsupported operation: Infinity or NaN toInt)".
The following is the code I tested.
SfCartesianChart(
zoomPanBehavior: ZoomPanBehavior(
enablePinching: true,
zoomMode: ZoomMode.x,
enablePanning: true),
trackballBehavior: TrackballBehavior(
lineType: TrackballLineType.vertical,
enable: true,
activationMode: ActivationMode.singleTap,
tooltipAlignment: ChartAlignment.near,
tooltipDisplayMode: TrackballDisplayMode.groupAllPoints,
),
primaryXAxis: CategoryAxis(
tickPosition: TickPosition.inside,
labelStyle:
CustomTextTheme().getTextTheme(context).overline?.copyWith(
color: ColorTheme.surfaceDisabledEmphasis,
),
),
primaryYAxis: NumericAxis(
opposedPosition: true,
plotBands: [
lowerMaskLine != null
? PlotBand(
verticalTextPadding: '5%',
horizontalTextPadding: '5%',
start: lowerMaskLine,
end: lowerMaskLine! - 999999999999,
color: ColorTheme.error100,
opacity: 0.1,
)
: PlotBand(color: Colors.white, opacity: 0.0),
upperMaskLine != null
? PlotBand(
verticalTextPadding: '5%',
horizontalTextPadding: '5%',
start: upperMaskLine,
end: upperMaskLine! + 999999999999,
color: ColorTheme.error100,
opacity: 0.1,
)
: PlotBand(color: Colors.white, opacity: 0.0),
PlotBand(
start: lowerMaskLine,
end: upperMaskLine,
color: ColorTheme.success100,
opacity: 0.1),
upperMaskLine != null
? PlotBand(
verticalTextPadding: '5%',
horizontalTextPadding: '0%',
start: upperMaskLine,
end: upperMaskLine,
textStyle: CustomTextTheme()
.getTextTheme(context)
.bodyText2
?.copyWith(color: ColorTheme.error500),
borderColor: ColorTheme.error500,
borderWidth: 1.5)
: PlotBand(color: Colors.white, opacity: 0.0),
lowerMaskLine != null
? PlotBand(
verticalTextPadding: '-5%',
horizontalTextPadding: '0%',
start: lowerMaskLine,
end: lowerMaskLine,
verticalTextAlignment: TextAnchor.start,
textStyle: CustomTextTheme()
.getTextTheme(context)
.bodyText2
?.copyWith(color: ColorTheme.error500),
borderColor: ColorTheme.error500,
borderWidth: 1.5)
: PlotBand(color: Colors.white, opacity: 0.0),
],
labelStyle:
CustomTextTheme().getTextTheme(context).overline?.copyWith(
color: ColorTheme.surfaceDisabledEmphasis,
),
tickPosition: TickPosition.inside,
),
series: <ColumnSeries>[
ColumnSeries<ChartData, String>(
dataSource: [
ChartData('0', 6.0),
ChartData('1', 2.3),
ChartData('2', 5.3),
ChartData('3', 3.2),
ChartData('4', 3.5),
ChartData('5', 9.3),
ChartData('6', double.nan),
],
xValueMapper: (datum, index) => datum.x,
yValueMapper: (datum, index) => datum.y),
],
),
class ChartData {
ChartData(this.x, this.y);
final String x;
final double? y;
}