SciChart® the market leader in Fast WPF Charts, WPF 3D Charts, and now iOS Charting & Android Chart Components

Welcome to the SciChart Community Forums!

Please use the forums below to ask questions about SciChart. Take a moment to read our Question asking guidelines on how to ask a good question and our support policy. We also have a tag=SciChart on Stackoverflow.com where you can earn rep for your questions!

Please note: SciChart team will only answer questions from customers with active support subscriptions. Expired support questions will be ignored. If your support status shows incorrectly, contact us and we will be glad to help.

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.