This question is locked. New answers and comments are not allowed.
Hi!
I have tried to create a custom template for a tooltip and I've implemented a simple template with custom context. However I realized that the tooltip displays only one series' values in the ClosestDataPoint. While debugging this I noticed that all the DataPointInfos had the same DistanceToTouchLocation, and I assume this is the reason why the ClosestDataPoint's series is always the same.
I was wondering if there's a solution for this.
- Tinja
In the ChartTooltipBehavior I've defined the TriggerMode to be Hold and SnapToClosestPoint is set to true.
Here's my implementation of the template and the ContextNeeded event handler:
I have tried to create a custom template for a tooltip and I've implemented a simple template with custom context. However I realized that the tooltip displays only one series' values in the ClosestDataPoint. While debugging this I noticed that all the DataPointInfos had the same DistanceToTouchLocation, and I assume this is the reason why the ClosestDataPoint's series is always the same.
I was wondering if there's a solution for this.
- Tinja
In the ChartTooltipBehavior I've defined the TriggerMode to be Hold and SnapToClosestPoint is set to true.
Here's my implementation of the template and the ContextNeeded event handler:
<telerikChart:RadCartesianChart.TooltipTemplate><DataTemplate><Grid><Grid.RowDefinitions> <RowDefinition/>
<RowDefinition/></Grid.RowDefinitions><TextBlock Text="{Binding Path=Header}"/><TextBlock Text="{Binding Path=Content}" Grid.Row="1"/></Grid></DataTemplate>
</telerikChart:RadCartesianChart.TooltipTemplate>
private void ChartTooltipBehavior_ContextNeeded(object sender, TooltipContextNeededEventArgs e) { e.Context = new CustomTooltipContext() { Header = e.DefaultContext.ClosestDataPoint.Series.DisplayName, Content = e.DefaultContext.ClosestDataPoint.DisplayContent.ToString() }; }