Overwrites the chart when it is called from another page

can anyone help me ?

must be like this https://prnt.sc/26m2aie

but when you do it up and down on the page

happens like this https://prnt.sc/26m2a84


main page

return Scaffold(
appBar: AppBar(
backgroundColor: const Color(0xff30373e),
title:
const Text("Yönetici Özeti", style: TextStyle(color: Colors.white)),
),
body: ListView(
children: <Widget>[
Expanded(
child: Card(
color: Colors.white,
child: SpesificConsumptionChart(),
shadowColor: Colors.grey.withOpacity(0.5),
elevation: 8,
margin: const EdgeInsets.all(20),
shape: OutlineInputBorder(
borderRadius: BorderRadius.circular(10),
),
),
),


Chart page

SfCartesianChart_buildSpesificConsumptionChart(BuildContextcontext) {
returnSfCartesianChart(
zoomPanBehavior: _zoomPanBehaviorLine,
trackballBehavior: _trackballBehaviorLine,
// Enables the legend
legend: Legend(
isVisible: true,
position: LegendPosition.top,
),
title: ChartTitle(
text: spesificConsumptionDataTitle,
backgroundColor: Colors.white,
borderWidth: 2,
// Aligns the chart title to left
alignment: ChartAlignment.center,
textStyle: constTextStyle(
color: Colors.black,
fontFamily: 'Roboto',
fontSize: 14,
)),
// Initialize category axis
primaryXAxis: CategoryAxis(),
primaryYAxis: NumericAxis(),
series: <ChartSeries>[
// Initialize line series
SplineSeries<_SpesificConsumptionData, String>(
dataSource: spesificConsumptionData,
name: spesificConsumptionDataLegendTitle,
xValueMapper: (_SpesificConsumptionDatadata, _) => data.x,
yValueMapper: (_SpesificConsumptionDatadata, _) => data.y,
)
]);
}

3 Replies

YG Yuvaraj Gajaraj Syncfusion Team January 31, 2022 04:06 PM UTC

Hi Mehmet,  
  
Greetings from Syncfusion. We have analyzed your query and we have tried to reproduce the reported issue from the given code snippet in the query. But the reported issue regarding line get render between the start and end of the data point is not reproduced at our end, we suspect that you might be adding same set of data having same x value due to which the issue is occurring so, kindly please try to remove the duplicate data if this is your case.  
  
If this is not your case, then please provide more information like sample with reproduce steps that will be more helpful to us to provide a solution sooner.  
  
Regards,  
Yuvaraj.  



ME mehmet January 31, 2022 06:28 PM UTC

i was using listview for display charts, then i changed it to listview.builder. when i set itemcount to 1 my problem was solved. 

Really comprehensive and beautiful package. 

Thanks for your feedback! 




YG Yuvaraj Gajaraj Syncfusion Team February 1, 2022 01:47 PM UTC

Hi Mehmet, 
 
Most welcome and thanks for your valuable feedbacks. We are happy to hear that the issue has been resolved from your side. If you need any further assistance, please get back to us we are always happy to assist you. 
 
Regards, 
Yuvaraj.

Loader.
Up arrow icon