The Syncfusion® native Blazor components library offers 70+ UI and Data Viz web controls that are responsive and lightweight for building modern web apps.
.NET PDF framework is a high-performance and comprehensive library used to create, read, merge, split, secure, edit, view, and review PDF files in C#/VB.NET.
I want to update the chart when I add a plotband, or change CrosshairBehavior. Is the only to refresh the chart to update the new config (for example, new CrosshairBehavior) is by calling setState()?
YGYuvaraj Gajaraj Syncfusion Team March 1, 2022 04:20 PM UTC
Hi Peter,
Greetings from Syncfusion. Yes, you need to call setState for the new configuration to take effect in the chart, however we suggest you to wrap the SfCartesianChart widget inside the StatefulBuilder then call the setState inside the StatefulBuilder, it won't reload the entire application. Here we have attached the code snippet below for your reference.
Code snippet:
StatefulBuilder(builder: (context, setState) {
returnColumn(children: [
SfCartesianChart(
//Other required properties
crosshairBehavior: _crosshairBehavior,
),
ElevatedButton(
onPressed: () {
setState(() {
_crosshairBehavior = CrosshairBehavior(
activationMode: ActivationMode.doubleTap,
enable: true
);
});
},
child: Text('press'))
]);})
Regards,
Yuvaraj.
Need More Help?
Get personalized assistance from our support team.