We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date
close icon

ChartZoomPanBehavior / DoubleTap

I want to create custom behaviour when a chart is double tapped.

I can add my own (conventional) TapGestureRecognizer to the chart view but it never gets fired so I'm assuming SFChart "hogs" this event and will only let me use the default behaviour.

I even tried creating my own ChartBehaviour:

public class ChartDoubleTapBehaviour :  ChartBehavior  

Is there any way of hijacking the double tap event on  ChartZoomPanBehavior  to customize the response to it? It looks like I just have to accept your default behaviour?




14 Replies

YP Yuvaraj Palanisamy Syncfusion Team May 6, 2015 11:02 AM UTC

Hi Mark,

Thanks for using Syncfusion products.

We would like to let you know that you can achieve your requirement by inheriting ChartZoomPanBehavior class, and you can customize the gestures by override the required methods. We have also prepared a sample to customize the double tap gesture on ChartZoomPanBehavior,

Please find the sample from the following location.

Sample: http://www.syncfusion.com/downloads/support/forum/119017/CustomZooming923233549.zip

Please let us know if you require further assistance on this.

Thanks,
Yuvaraj P


MH Mark Hatton May 6, 2015 03:52 PM UTC

Thanks, that works.


YP Yuvaraj Palanisamy Syncfusion Team May 7, 2015 11:55 AM UTC

Hi Mark,

Thanks for the update. Please let us know if you require further assistance on this.

Thanks,
Yuvaraj P


AL Alexander June 16, 2015 05:30 PM UTC

hi  Yuvaraj :D

sorry if this can't do, but I want to know how to do the same in XAML jejeje 

this part:
   ChartDoubleTapBehavior zoom = new ChartDoubleTapBehavior
             {
                 EnablePanning = true,
                 EnableZooming = true,
             };
          
            chart.ChartBehaviors.Add(zoom);



apologies for the inconvenience


YP Yuvaraj Palanisamy Syncfusion Team June 17, 2015 07:27 AM UTC

Hi Alexander,

We request you to use the following code snippet to initialize custom zoom behavior in XAML page,


[XAML]

 

Declaring namespace

xmlns:chart="clr-namespace:Syncfusion.SfChart.XForms;assembly=Syncfusion.SfChart.XForms"   xmlns:local="clr-namespace:SimpleSample;assembly=SimpleSample"

Adding custom behavior

<chart:SfChart.ChartBehaviors>
      <local:ChartDoubleTapBehavior  EnablePanning = "true"  EnableZooming = "true"/>
 </chart:SfChart.ChartBehaviors>


Please let us know if you require further assistance.

Thanks,
Yuvaraj P
 


AL Alexander June 17, 2015 02:40 PM UTC

Hi Yuvaraj 

I was too close, thanks for that, but when I zoom the Labels on the top of the columns instead of become big, they become small

To take advantage of topic, the the aesthetics of the charts is small, the data is not appreciated properly on the screen of the device, is there a way to improve the visual part of the chart?

Thanks a lot


YP Yuvaraj Palanisamy Syncfusion Team June 18, 2015 11:28 AM UTC

Hi Alexander,

In the Chart zooming feature it is used to view the data points clearly when more number of data plotted on the Chart, for this Chart range only will get zoomed and the elements like data markers, data marker labels will not be zoomed and it remains the same size (not small), this is the design of Chart zooming feature.

Would you like to get the data marker labels also zoomed?

Please let us know if you need any further assistance on this.

Thanks,
Yuvaraj


AL Alexander June 18, 2015 02:15 PM UTC

Hi Yuvaraj

That would be great. I don't know if I need to open a new thread to talk about the design, I mean, the labels of X, Y and values are too small, I can't read them well in my phone. Is there some way to appreciate the data a little better ?

Thanks a lot


AL Alexander June 18, 2015 09:37 PM UTC

I am again jeje

I have another question, the chart zooming feature is just for some charts? I implemented it in a Stacking Columns Chart and when I did zoom, the middle label froze in the screen (attached file)

Thanks


Attachment: Screenshot_20150618151649_9ad75ab8.zip


YP Yuvaraj Palanisamy Syncfusion Team June 19, 2015 09:06 AM UTC

Hi Alexander,


We can change the font size of the axis labels and data marker using the below code snippet.


C#


//Used to change the size of axis label font size

sfChart.PrimaryAxis.LabelStyle.Font = Font.SystemFontOfSize(30);


//Used to change the size of data marker label font size

columnSeries.DataMarker.LabelStyle.Font = Font.SystemFontOfSize(30);










                   

 

 

We have analyzed the reported issue with Stacking column data marker label position and it has been already fixed in the latest service pack release. So we request you to use the latest version of Syncfusion Xamarin Studio which is available from the following link.


Link: http://www.syncfusion.com/forums/119275/essential-studio-2015-volume-1-service-pack-2-release-v13-1-0-30-available-for-download    


Please let us know, if you need any further assistance.


Thanks,

Yuvaraj P



AL Alexander June 19, 2015 09:33 PM UTC

Hi Yuvaraj

thanks for your helping, now I am able to change the size (I am so happy because I colud transcript it to xaml wiii), could you help me with the zoom of labels too

thanks for all, you are amazing


YP Yuvaraj Palanisamy Syncfusion Team June 22, 2015 10:26 AM UTC

Hi Mark,

Thanks for the update.

Could you please confirm us whether your requirement is to zoom the data marker labels while performing the zooming on Chart?

Thanks,
Yuvaraj


AL Alexander June 22, 2015 02:32 PM UTC

Hi Yuvaraj

yes, the labels keep in the same position now :D It's working perfectly 

very thanks n.n


YP Yuvaraj Palanisamy Syncfusion Team June 23, 2015 05:06 AM UTC

Hi Alexander,

Thanks for the update.

Please let us know if you need any further assistance on this.

Thanks,
Yuvaraj

Loader.
Live Chat Icon For mobile
Up arrow icon