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

Trackball behavior on touch events in UWP

The end product of my solution is going to be primarily used on a touch first device.  I have live streaming data on a chart and would like to be able to take advantage of the interactive trackball that I can manipulate by hovering with the mouse.

Is it possible to invoke this with a touch event?

4 Replies

RA Rachel A Syncfusion Team June 1, 2016 05:05 AM UTC

Hi Jason, 
Thanks for contacting Syncfusion support. 
SfChart provides interactive trackball feature, which supports for touch input devices also.  
You can refer the below UG documentation to know more information on trackball. 

Note: We don’t need to invoke the trackball explicitly. 
Also if this is not your requirement and if you have any specific requirement in trackball related with events, please revert us with more information. So that we can provide you a better solution. 
Rachel. A 

JT Jason Traud June 1, 2016 01:52 PM UTC


Thank you for your reply. I've been using this reference and have it working, but only with a mouse hover. I'm doing this all in C# and I'm not using XAML. I've pasted my current configuration code below. Is there something I'm missing that may be preventing this from working with touch? When testing with the touch screen on my laptop the pinch and zoom events work when the ChartZoomPanBehavior block is not commented out.  I've been keeping this commented out just in case the touch events for zooming conflicted with the trackball. 

If the trackball behavior just won't work with touch, is it possible to have the call-out being set by a button? The data I'm displaying is a 0 to 1024 range. I can see it being acceptable to use a slider or a button to set the highlighted trackball point on the x-axis.

[code]            //SfChart chart = new SfChart();  // Defined as a global in MainPage.xaml.cs
            chart.Height = 300;
            chart.VerticalAlignment = VerticalAlignment.Top;

            Thickness chartMargin = new Thickness(20);
            chart.Margin = chartMargin;

            ChartZoomPanBehavior behavior = new ChartZoomPanBehavior();
            behavior.EnableZoomingToolBar = true;
            behavior.ToolBarItems = ZoomToolBarItems.All;
            behavior.HorizontalPosition = HorizontalAlignment.Left;
            behavior.VerticalPosition = VerticalAlignment.Top;
            behavior.ToolBarOrientation = Orientation.Horizontal;
            behavior.EnableSelectionZooming = true;
            chart.Behaviors.Add(behavior); */          

            ChartTrackBallBehavior trackballvisible = new ChartTrackBallBehavior();
            trackballvisible.UseSeriesPalette = true;

            CategoryAxis primaryAxis = new CategoryAxis();
            primaryAxis.Header = "Pixel";
            primaryAxis.ShowTrackBallInfo = true;
            primaryAxis.ShowGridLines = true;
            chart.PrimaryAxis = primaryAxis;
            NumericalAxis secondaryAxis = new NumericalAxis();
            secondaryAxis.Maximum = 4096;
            secondaryAxis.Header = "Intensity";
            chart.SecondaryAxis = secondaryAxis;

            series1.ItemsSource = this.Values;
            series1.XBindingPath = "pixel";
            series1.YBindingPath = "intensity";

            series1.ListenPropertyChange = true;

JT Jason Traud June 1, 2016 02:05 PM UTC

I think I see where the issue is. Tapping an holding on a static chart will pull up the trackball but when I have data streaming it won't do this. 

Is there a way to programatically set the highlighted data point by the trackball? Or even have the selection remain after a tap or a mouse click?

RA Rachel A Syncfusion Team June 2, 2016 03:09 PM UTC

Hi Jason, 
Thanks for the update. 
The Trackball can be moved using touch and hold in touch devices but it is not working with real time update in UWP winrt(tablet) and works fine for phone .We have logged internally an issue report as the trackball is not moving properly when there is live data update. If you require fix for this issue, please log in to create new incident.  
We can achieve also this requirement by moving the trackball using the button click event. We have prepared the sample for your reference and you can download from the following location. 
Rachel. A 

Live Chat Icon For mobile
Up arrow icon