I am using syncfusion_flutter_charts
library to display data in form of SplineAreaSeries
. I need to make the graph able to be scrollable to view numerous data.
I tried to use SingleChildScrollView
and changed the scrollDirection to Axis.horizontal
. It functions right but the graph like collapses, I don't know the reason behind this. I even tried Expanded
but nothing happened.
Container(
width: width,
height: height * 0.6,
child: SingleChildScrollView(
scrollDirection: Axis.horizontal,
child: SfCartesianChart(
borderColor: Colors.transparent,
primaryXAxis: NumericAxis(
maximum: 40,
minimum: 1,
interval: 1.0,
),
primaryYAxis: NumericAxis(
minimum: 0,
rangePadding: ChartRangePadding.round,
),
series: <ChartSeries<ChartData, int>>[
SplineAreaSeries<ChartData, int>(
dataSource: chartData,
xValueMapper: (ChartData data, _) => data.day,
yValueMapper: (ChartData data, _) => data.ppm,
name: 'Methane Concentrations',
gradient: LinearGradient(
colors: [
AppStyle.spline_color,
AppStyle.bg_color.withAlpha(150)
],
begin: Alignment.topCenter,
end: Alignment.bottomCenter,
),
),
SplineSeries(
dataSource: chartData,
xValueMapper: (ChartData data, _) => data.day,
yValueMapper: (ChartData data, _) => data.ppm,
color: AppStyle.accent_color,
width: 3,
)
],
),
),
),