Telerik blogs

One of the new features of the chart control for the Q2 Beta2 release is an API for behaviors. We decided do decouple the chart from some of its features and make them separate objects for the usual software development reasons. Now RadChart has a Behaviors collection that accepts ChartBehavior objects. Whenever an object is added to or removed from this collection a feature is either enabled or disabled in a RadChart instance respectively. We provide three behaviors out of the box and these are ChartPanAndZoomBehavior, ChartTrackballBehavior and ChartToolTipBehavior.

The tooltip behavior allows the chart to show a tooltip wherever the user taps or holds on the device screen. This tooltip is a small window that can display context sensitive information with the context being created based on the touch point and all the data points around it.

RadChart provides a basic context which contains the closest data point to the touch location and also, a collection of DataPointInfo objects that contain each series in the chart and the closest data point to the touch location for each of the series. With this basic context the tooltip can not show much but there is more. There is an event in the chart tooltip behavior which allows the user to create his/her own context based on the one that RadChart provides. This and the ability to specify a tooltip template causes the tooltip to be very customizable. This is because the context that the user can provide is set as the DataContext of the tooltip template and since the user has full control over both, he/she can display any information they want. Here is a screenshot of the tooltip (our tool tip example from our Examples application) showing simple information from the basic context:

chart tooltip

For more information and C#/VB/XAML examples of how to use the chart behaviors head on over to our online documentation. Also don't forget the forums, questions and feedback, positive or (constructively) negative, are always welcome.


Comments are disabled in preview mode.