BoldDeskWe are launching BoldDesk on Product Hunt soon. Learn more & follow us.
Hi,
I want to show tooltip at where user tapped, so I tried to set tooltipPosition to TooltipPosition.pointer, but seems it don't work?
Hi Zhu,
The TooltipPosition.pointer will work for a rectangle type series alone, it will show a tooltip when you tap anywhere in the column series segment. If you want to show the tooltip where is customer taps, this can be achieved with the help of the onChartTouchInteractionDown callback and showByPixel public method in the tooltip. We have shared the code snippet and related UG documentation below for your reference.
Code snippet:
late TooltipBehavior _tooltipBehavior; @override void initState() { _tooltipBehavior = TooltipBehavior(enable: true); super.initState(); } SfCartesianChart( onChartTouchInteractionDown: (tapArgs) { _tooltipBehavior.showByPixel( tapArgs.position.dx, tapArgs.position.dy); }, tooltipBehavior: _tooltipBehavior, ) |
UG,
https://help.syncfusion.com/flutter/cartesian-charts/methods#showbypixel-method-in-tooltipbehavior
https://help.syncfusion.com/flutter/cartesian-charts/callbacks#oncharttouchinteractiondown
Regards,
Yuvaraj.
Hi, Yuvaraj,
I tried it, it do work, but not as I expected, I realized that what I'm using is not tooltip, but trackball, which include 4 datas in a box.
So I tried onChartTouchInteractionDown callback and show way on it, but then it only show once at top left corner of chart.
Here's the seetings:
_trackballBehavior = TrackballBehavior(
lineType: TrackballLineType.horizontal,
activationMode: ActivationMode.singleTap,
enable: true,
tooltipAlignment: ChartAlignment.near,
shouldAlwaysShow: true,
tooltipDisplayMode: TrackballDisplayMode.groupAllPoints,
);
Any ideas?
Regards,
Zhu.
Hi, Yuvaraj,
I tried to set tooltipAlignment to ChartAlignment.far, it would not block the traces now, I think that's ok.
Thanks for the help.
Best Regards,
Zhu.
Most Welcome. Kindly get back to us if you have further queries. We are always happy to assist you.