isVisible changes to true when setting state.

class HabitSpline extends StatelessWidget {
@override
Widget build(BuildContext context) {
return Consumer<HabitGraphBloc>(
builder: (context, bloc, _) => SfCartesianChart(
margin: EdgeInsets.fromLTRB(0, 0, 0, 0),
legend: Legend(isVisible: false),
plotAreaBorderWidth: 0,
enableAxisAnimation: false,
primaryXAxis: DateTimeAxis(
isVisible: false,
minimum: DateTime.now().add(Duration(hours: 12)),
maximum: DateTime.now().add(Duration(days: 7, hours: 12)),
),
primaryYAxis: NumericAxis(
isVisible: false,
rangePadding: ChartRangePadding.additional,
),
series: <SplineSeries<PointData, DateTime>>[
for (var graph in bloc.loadedGraphs)
SplineSeries<PointData, DateTime>(
isVisible: graph.isVisible,
markerSettings: MarkerSettings(
isVisible: true,
height: 14,
width: 14,
borderWidth: 6,
borderColor: graph.color,
),
width: 10,
color: graph.color,
emptyPointSettings: EmptyPointSettings(
mode: EmptyPointMode.average,
),
// Bind data source
dataSource: graph.points,
xValueMapper: (PointData pointData, _) =>
DateTime.now().add(Duration(days: pointData.index)),
yValueMapper: (PointData pointData, _) => pointData.points,
)
],
),
);
}
}

Here i am loading some graph values and giving them to a SfCartesianChart. All of them are splines , but
some of them are visible and some of them are not. When i setState, suddently all graphs become visible
again. What i want to happen is that spline series, isVisible value, retains its original value when setting state.
I am using a consumer in this example but it happens with a normal constructor also.

I ended up fixing it with this line below the for loop in the splineSeries argument
if (graph.isVisible)
Still i would consider it a bug

1 Reply

DP Dharanitharan Palanisamy Syncfusion Team August 11, 2021 02:12 PM UTC

Hi Marco, 
 
Greetings from the team at Syncfusion. We have looked into your request, but we have not been able to duplicate the stated issue on our end. We would want to point out that the default value for isVisible is true, and based on the code snippet, we believe you are changing the value for the visible property, which could cause the problem. We checked and everything works perfectly on our end, and we have included a sample for your review. If the problem persists, please contact us with the duplicated issue in the attached sample. This will allow us to investigate deeper and give you a solution sooner. 
 
 
Thanks, 
Dharanitharan. P 


Loader.
Up arrow icon