Pre loader

Z-order of TooltipModifier

Welcome to the SciChart Forums!

  • Please read our Question Asking Guidelines for how to format a good question
  • Some reputation is required to post answers. Get up-voted to avoid the spam filter!
  • We welcome community answers and upvotes. Every Q&A improves SciChart for everyone

WPF Forums | JavaScript Forums | Android Forums | iOS Forums

Answered
1
0

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?

Images
  • You must to post comments
Best Answer
1
0

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

  • You must to post comments
Showing 1 result
Your Answer

Please first to submit.

Try SciChart Today

Start a trial and discover why we are the choice
of demanding developers worldwide

Start TrialCase Studies