ChartZoomPanBehavior Tool Bar Menus not working on touch device

Hi,

Our application needs to work on Touch and Non-Touch device, We are using SFChart control for plotting long graph.
We have set ChartZoomPanBehavior tool bar menu, but these buttons are not working on touch device.

Also i want to know how i can achieve Autoscale for long x-axis.

Thanks
Santosh Bhivase

5 Replies

MK Muneesh Kumar G Syncfusion Team May 23, 2018 08:18 AM UTC

Hi Santosh, 
 
Thanks for using Syncfusion products.  
 
Query 1: Our application needs to work on Touch and Non-Touch device, We are using SFChart control for plotting long graph. We have set ChartZoomPanBehavior tool bar menu, but these buttons are not working on touch device. 
 
We have analyzed your query, we have checked SfChart sample with legend, annotation, stripline, selection, crosshair, trackball, tooltip and adornment features. ZoomingToolbar working fine in touch interaction with these features. Can you please check with the sample in the following location? If still you face the problem, please revert us by modifying the sample based on your application along with replication procedure. This would be helpful for us to serve you. 
 
 
Also, please update us Syncfusion reference version, which is used in your application.  
 
Query 2: Also i want to know how i can achieve Autoscale for long x-axis. 
 
You can achieve this requirement by customizing axis ranges using ActualRangeChanged event of chart axis as per the below code snippet. 
 
Code snippet [XAML]: 
           <chart:SfChart.PrimaryAxis> 
                <chart:NumericalAxis ActualRangeChanged="NumericalAxis_ActualRangeChanged"> 
                    .. 
                </chart:NumericalAxis> 
            </chart:SfChart.PrimaryAxis> 
 
 
Code snippet [C#]: 
        bool isLoaded = false; 
        int autoScrollingDeltaValue = 3; 
        public MainWindow() 
        { 
            InitializeComponent(); 
            Loaded += MainWindow_Loaded; 
            
        } 
 
        private void MainWindow_Loaded(object sender, RoutedEventArgs e) 
        { 
            isLoaded = true; 
            (chart.PrimaryAxis as NumericalAxis).Minimum = chart.PrimaryAxis.VisibleRange.End - autoScrollingDeltaValue; 
        } 
 
        private void NumericalAxis_ActualRangeChanged(object sender, ActualRangeChangedEventArgs e) 
        { 
            if (e.IsScrolling || !isLoaded) 
                return; 
 
            e.VisibleMinimum = (double)e.ActualMaximum - autoScrollingDeltaValue; 
        } 
  
Please let us know if you have any queries.  
 
Thanks, 
Muneesh Kumar G. 
 



SA santosh August 24, 2018 06:01 AM UTC

Hi,

We can not use sfchart behaviour and IsManipulationEnabled together.
If we set IsManipulationEnabled to true then Zoom toolbar button doesn't work for touch screen.
And if we remove then we can not to pinch zoom.
Note: If we set IsManipulationEnabled to true then Zoom toolbar button working with mouse click, but not through touch.

Please help with these issues, thank you.


Attachment: WPF_Sample_4259928f.zip


MK Muneesh Kumar G Syncfusion Team August 24, 2018 10:45 AM UTC

Hi Santosh, 
 
We have analyzed your query and we would like to inform you that mouse down/up events have not raised while using IsManipulationEnabled as true in UIElement. So, we have resolved this problem by raising toolbar item’s mouse events in SfChart touch action as per the below code snippet.  
 
Code snippet [XAML]: 
  <chart:SfChart  Grid.Row="1" TouchDown="chart_TouchDown" 
                       x:Name="chart" IsManipulationEnabled="True"> 
 
Code snippet [C#]: 
  public partial class MainWindow : Window 
    { 
        public MainWindow() 
        { 
            InitializeComponent(); 
        } 
 
        private void chart_TouchDown(object sender, TouchEventArgs e) 
        { 
            if (e.OriginalSource is FrameworkElement) 
            { 
                var context = (e.OriginalSource as FrameworkElement).DataContext; 
 
                if (context is ZoomingToolBarItem) 
                { 
                    MouseButtonEventArgs args = new MouseButtonEventArgs(Mouse.PrimaryDevice, 0, MouseButton.Left); 
                    args.RoutedEvent = UIElement.MouseLeftButtonDownEvent; 
                    args.Source = (context as ZoomingToolBarItem); 
                    (context as ZoomingToolBarItem).RaiseEvent(args); 
                } 
            } 
        } 
    } 
 
We have modified your sample based on this, please find the sample from the following location.  
 
 
Please let us know if you have any other queries.  
 
Thanks, 
Muneesh Kumar G. 



SA santosh August 28, 2018 08:52 AM UTC

Hi Muneesh ,

Thanks for your quick response. Your solution is helpful for us.




PR Padmini Ramamurthy Syncfusion Team August 30, 2018 11:39 AM UTC

Hi Santhosh, 
  
Glad that the provided solution was helpful for you and please get back to us if you need any other assistance. 
  
Regards, 
Padmini R 


Loader.
Up arrow icon