How To bind a click on the chart to a Command

I am trying to move to a new page when the user single taps on the SfChart. I have tried a tapGestureRecogniser on the SfChart and the enclosing Grid but taps on the Grid get ignored

is this possible?


3 Replies

NT Nitheeshkumar Thangaraj Syncfusion Team September 12, 2023 09:37 AM UTC

Hi Pat,

We would like to inform you that we have obtained the touch position by extending the ChartTooltipBehaviour class. We have provided the link to the User Guide documentation below for detailed clarification.


https://help.syncfusion.com/xamarin/charts/how-to/get-the-touch-position-in-chart



If you are expecting drill-down functionality, the Knowledge Base link is also provided.

https://support.syncfusion.com/kb/article/9388/how-to-use-the-drill-down-functionality-in-xamarin-forms-chart



If the above approach does not help your use case, please share more information for a better understanding so that we can effectively fulfill your needs.


Regards,
Nitheeshkumar



PA Pat September 20, 2023 04:57 PM UTC

If we move to double tap then the Behavior approach is a good solution


Thanks



NT Nitheeshkumar Thangaraj Syncfusion Team September 21, 2023 12:38 PM UTC

Hi Pat,


Based on your information, you can extend the ChartTooltipBehavior class, override the DoubleTap method, and obtain the touch position within that method to customize the code as needed. The code snippet is provided below.


public class BehaviorExt : ChartTooltipBehavior

{

       protected override void DoubleTap(float pointX, float pointY)

      {

          base.DoubleTap(pointX, pointY);

 

          // Customize your code here

      }

}


<chart:SfChart.ChartBehaviors>

    <local:BehaviorExt></local:BehaviorExt>

</chart:SfChart.ChartBehaviors>


Additionally, if you need any further assistance, please let us know.


Regards,

Nitheeshkumar


Loader.
Up arrow icon