As Q2 2011 is officially out, we are really excited about all the interactivity features we shipped with our charting component. Together with all the built-in goodies like PanAndZoom, Trackball and Tooltip, we have also implemented a flexible and convenient way for extending the default gesture handling behavior of RadChart. By implementing a handler for the RadChart.PreviewGesture event you may provide completely custom interactivity depending on your custom scenario. When marked as “Handled” the event will have higher priority than any default behaviors registered with the Chart.
Let’s play a bit more with the PreviewGesture event by implementing a very simple drill-down scenario that changes the data source of the chart when clicked on a Bar item.
The XAML is minimal – we have a Cartesian chart with one Bar series and a handler for the PreviewGesture event:
And the handler looks like:
sender, ChartGestureEventArgs e)
(e.Gesture.GestureType == GestureType.Tap)
HandleTap(GestureSample gesture, ChartDataContext context)
Point touchLocation =
// tap is directly on a bar
// toggle data sources
Gotcha: The ChartGestureEventArgs.PrimaryLocation property is not properly translated to chart coordinates, so do not use it until our next internal build :)
Now let's handle the Hold gesture and perform a scale animation upon the chart:
(e.Gesture.GestureType == GestureType.Hold)
HandleHold(GestureSample gesture, ChartDataContext context)
.ScaleChart(1, 1, 2, 2);
RadScaleAnimation scale =
scale.StartScaleX = fromX;
scale.StartScaleY = fromY;
scale.EndScaleX = endX;
scale.EndScaleY = endY;
Pretty easy, right? We have further plans of extending the chart interactivity with selection, visual filtering and probably annotations, so stay tuned for future releases :)
Attached is the sample project, you will just need to add the Telerik references to it. Enjoy!
Copyright © 2017, Progress Software Corporation and/or its subsidiaries or affiliates. All Rights Reserved.
Progress, Telerik, and certain product names used herein are trademarks or registered trademarks of Progress Software Corporation and/or one of its subsidiaries or affiliates in the U.S. and/or other countries. See Trademarks or appropriate markings.