Welcome to the Flutter feedback portal. We’re happy you’re here! If you have feedback on how to improve the Flutter, we’d love to hear it!>
Thanks for joining our community and helping improve Syncfusion products!
It seem that plot band is not working well.
example code:
import 'package:flutter/material.dart';
import 'package:syncfusion_flutter_charts/charts.dart';
void main() { runApp(TestPage());
}
class TestPage extends StatelessWidget {
Widget build(BuildContext context) {
final List<Data> chartData = [
Data(0, -3),
Data(1, 2),
Data(2, 4),
Data(3, 8),
Data(4, 1),
];
return MaterialApp( home: Scaffold( appBar: AppBar( title: Text('Test'),
),
body: SfCartesianChart( series: <ChartSeries>[ LineSeries<Data, double>( dataSource: chartData,
xValueMapper: (Data sales, _) => sales.x,
yValueMapper: (Data sales, _) => sales.y,
),
],
primaryYAxis: NumericAxis(
plotBands: [
// replace the comment/code here with the code snippets for each case
],
),
),
),
);
}
}
class Data {
final double x;
final double y;
Data(this.x, this.y);
}
case 1
PlotBand(
start: 0,
end: -6,
)
case 2
PlotBand(
start: 20,
end: 3,
)
Problem: In these two cases, the plot bands are overflowed and may hide the axis label.
Case 3
primaryYAxis: NumericAxis(
visibleMinimum: 0,
visibleMaximum: 4,
plotBands: [
PlotBand(
start: 0,
end: 1,
),
],
),
zoomPanBehavior: ZoomPanBehavior(
enablePanning: true,
),
PlotBand(
start: 3,
),
I/flutter (28288): ══╡ EXCEPTION CAUGHT BY RENDERING LIBRARY ╞═════════════════════════════════════════════════════════
I/flutter (28288): The following NoSuchMethodError was thrown during paint():
I/flutter (28288): The method '<=' was called on null.
I/flutter (28288): Receiver: null
I/flutter (28288): Tried calling: <=(4.0)
I/flutter (28288):
I/flutter (28288): The relevant error-causing widget was:
I/flutter (28288): CustomPaint
I/flutter (28288): file:///C:/Dev/Flutter/.pub-cache/hosted/pub.dartlang.org/syncfusion_flutter_charts-17.4.40/lib/src/chart/base/chart_base.dart:1319:23
I/flutter (28288):
I/flutter (28288): When the exception was thrown, this was the stack:
I/flutter (28288): #0 Object.noSuchMethod (dart:core-patch/object_patch.dart:53:5)
I/flutter (28288): #1 _PlotBandPainter._renderPlotBandElement (package:syncfusion_flutter_charts/src/chart/axis/plotband.dart:638:13)
I/flutter (28288): #2 _PlotBandPainter._renderPlotBand (package:syncfusion_flutter_charts/src/chart/axis/plotband.dart:580:7)
I/flutter (28288): #3 _PlotBandPainter.paint (package:syncfusion_flutter_charts/src/chart/axis/plotband.dart:516:11)
I/flutter (28288): #4 RenderCustomPaint._paintWithPainter (package:flutter/src/rendering/custom_paint.dart:531:13)