Hello,
It seems to me that the Z-order of the TooltipModifier is the reverse of the series. I’m using the following modifier code:
<s:TooltipModifier ReceiveHandledEvents="True" UseInterpolation="False" >
<s:TooltipModifier.TooltipLabelTemplate>
<ControlTemplate TargetType="s:TemplatableControl">
<Border Background="White" BorderBrush="Gray" BorderThickness="1" CornerRadius="2" Padding="5" Opacity="0.9" >
<StackPanel Orientation="Vertical">
<TextBlock FontSize="14" Text="{Binding SeriesName}" FontWeight="Bold" Foreground="{Binding SeriesColor, Converter={StaticResource colorBrushConverter}}" />
<Border Height="1" HorizontalAlignment="Stretch" VerticalAlignment="Center" />
<TextBlock FontSize="12" Foreground="{Binding SeriesColor, Converter={StaticResource colorBrushConverter}}" >
<Run Text="X: " FontWeight="Bold"/>
<Run Text="{Binding XValue, StringFormat=\{0:0.###\}}"/>
</TextBlock>
<TextBlock FontSize="12" Foreground="{Binding SeriesColor, Converter={StaticResource colorBrushConverter}}">
<Run Text="Y: " FontWeight="Bold"/>
<Run Text="{Binding YValue, StringFormat=\{0:0.###\}}"/>
</TextBlock>
</StackPanel>
</Border>
</ControlTemplate>
</s:TooltipModifier.TooltipLabelTemplate>
</s:TooltipModifier>
If I then add two series to the surface the tooltip will preferentially show the series with the lowest Z-order (see attached image). Is there something I can do to fix this?
- Garrett McCardle asked 7 years ago
- You must login to post comments
Hi Garrett,
Thanks for your request. The reason for this behavior is that TooltipModifier shows the tooltip for the first RenderableSeries which is reported to be hit by the cursor.
It is quite easy to change. If you have only two series, I think the best way would be setting IsSelected to “True” on one series and
SourceMode to “SelectedSeries” on the TooltipModifier.
If there are more series, you could override the GetSeriesInfoAt method in the following way:
protected override IEnumerable<SeriesInfo> GetSeriesInfoAt(Point point)
{
if (ParentSurface != null && !ParentSurface.RenderableSeries.IsNullOrEmpty())
{
foreach (var renderableSeries in ParentSurface.RenderableSeries.Reverse())
{
if (IsSeriesValid(renderableSeries))
{
HitTestInfo hitTestInfo = renderableSeries.HitTest(point, UseInterpolation);
if (IsHitPointValid(hitTestInfo))
{
var seriesInfo = renderableSeries.GetSeriesInfo(hitTestInfo);
yield return seriesInfo;
}
}
}
}
}
The key change here is taking RenderableSeries in the reverse order ParentSurface.RenderableSeries.Reverse().
Hope this helps!
Best regards,
Yuriy
- Guest answered 7 years ago
- You must login to post comments
Please login first to submit.