The graph's height is changed by swiping in case the user's first touch is on one of the graphs.

I am using scrolling in SfCartesianChart and this is my code . i am facing this issue on my end (The graph's height is changed by swiping in case the user's first touch is on one of the graphs.) Please check the attached video for understanding the issue and please provide a solution for this issue.


SfCartesianChart(
onChartTouchInteractionDown:
(ChartTouchInteractionArgs args) {
setState(() {
showTooptip = false;
});
},
plotAreaBorderWidth: 0,
onActualRangeChanged: (ActualRangeChangedArgs args) {
if (args.orientation == AxisOrientation.horizontal) {
oldAxisVisibleMin = args.visibleMin.toDouble();
oldAxisVisibleMax = args.visibleMax.toDouble();
}
},
// enableAxisAnimation: true,
zoomPanBehavior: ZoomPanBehavior(
// Enables pinch zooming
enablePanning: true,
),
primaryXAxis: CategoryAxis(
interval: 1,
visibleMinimum: oldAxisVisibleMin,
visibleMaximum: oldAxisVisibleMax,
majorGridLines: const MajorGridLines(
width: 0,
color: AppColors.white,
),
majorTickLines: const MajorTickLines(
width: 0,
color: AppColors.white,
),
labelStyle: const TextStyle(
fontSize: 10,
fontFamily: 'Lato',
fontWeight: FontWeight.w400,
color: AppColors.black),
labelPosition: ChartDataLabelPosition.outside,
edgeLabelPlacement: EdgeLabelPlacement.none,
labelAlignment: LabelAlignment.center,
labelPlacement: LabelPlacement.onTicks,
arrangeByIndex: true,
tickPosition: TickPosition.inside,
axisLine: const AxisLine(
color: AppColors.white,
width: 0,
)),
primaryYAxis: NumericAxis(
isVisible: false,
plotBands: <PlotBand>[
PlotBand(
textStyle: const TextStyle(
color: AppColors.grey8,
fontSize: 12,
fontFamily: 'Lato',
fontWeight: FontWeight.w400),
// horizontalTextPadding: '-50%',
textAngle: 0,
isVisible: true,
start: widget.avg.toInt(),
end: widget.avg.toInt(),
borderWidth: 0.5,
borderColor: AppColors.grey8,
),
],
),
tooltipBehavior: TooltipBehavior(
canShowMarker: false,
enable: true,
),
onTooltipRender: (TooltipArgs args) => tool(args),
// Callback to customize the marker
onMarkerRender: (MarkerRenderArgs args) =>
markerRender(args),
series: <ChartSeries>[
LineSeries<SalesData, String>(
onCreateRenderer:
(ChartSeries<dynamic, dynamic> series) {
return CustomLineSeriesRenderer(
series, getfirstmarkerPoint);
},
enableTooltip: true,
markerSettings: const MarkerSettings(
isVisible: true, width: 5.0, height: 5.0),
dataSource: personalMetricData,
pointColorMapper: (SalesData sales, _) =>
sales.color,
xValueMapper: (SalesData sales, _) => sales.date,
yValueMapper: (SalesData sales, _) =>
sales.data.toInt())
])


Attachment: WhatsApp_Video_20220424_at_09.49.49.mp4_d7138d0f.zip

1 Reply

YG Yuvaraj Gajaraj Syncfusion Team May 22, 2022 05:05 PM UTC

Hi Vikram,


Greetings from Syncfusion. You are calling the setState() method in the onChartTouchInteractionDown callback to hide the tooltip, but it rebuilds the whole chart which is why it looks like the height gets changed. So, we suggest you use the tooltip public method hide() to hide the tooltip to avoid rebuilding the chart. If you still face any issues, please try to provide a sample with reproducing steps. That will be more helpful to us to provide a solution sooner.


UG: https://help.syncfusion.com/flutter/cartesian-charts/methods#hide-method-in-tooltipbehavior


Regards,

Yuvaraj.


Loader.
Up arrow icon