Pre loader

Custom Rollover for Different DataSeries

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

1
0

I have a custom ControlTemplate for the Rollover modifier that works fine for an OHLC DataSeries (see Chart_Rollover_One_Series.png), but as soon as I start adding other DataSeries (of different types, particularly XY), the ControlTemplate doesn’t work for it (as expected and as can be seen on Chart_Rollover_Multiple_Series.png). So, my question is, how do I specify different templates for different dataseries types?

Another option I thought about was using the Cursor modifier (like the one on the SciTrader example) where there is only one unified tooltip for all the series, but I wasn’t able to modify the template correctly.

At the moment I have 1 OHLC DataSeries and 3 XYs, but what I want to achieve in the end is being able to add and remove DataSeries on the fly and being able to see their corresponding values when I am using either the Rollover or Cursor modifier.

I am no expert in WPF, so this actually might not be that complicated, but I just couldn’t figure it out.

Appreciate the help. I also have attached my current XAML file for your reference.

Attachments
Images
  • You must to post comments
1
0

Hi there,

Sorry for the delay in getting back to you. We’ve had a busy week! Ok – you are right, we use a DataTemplateSelector in our own themes to select different tooltips depending on DataSeries type.

E.g. an XyDataSeries has one type of template and an OhlcDataSeries has another type.

This is what we have in our styles (themes) to define the RolloverLabelTemplate (see Default.xaml if you are a source-code customer):

<!--  Template for the RolloverModifier tooltip to display single SeriesInfo (result of hit test)  -->
<ControlTemplate x:Key="RolloverLabelTemplate" TargetType="r:TemplatableControl">
    <Border Background="{Binding CursorLabelBackgroundBrush, Source={z:Static Member=s:ThemeManager.ThemeProvider}}"
            BorderBrush="{Binding CursorLabelBorderBrush, Source={z:Static Member=s:ThemeManager.ThemeProvider}}"
            BorderThickness="1"
            CornerRadius="5">
        <s:SeriesInfoTemplateSelector BandSeries1Template="{StaticResource BandSeriesCursorLabelTemplate}"
              BandSeries2Template="{StaticResource BandSeriesCursorLabelTemplate}"
              BoxPlotSeriesTemplate="{StaticResource BoxPlotRolloverLabelTemplate}"
              Content="{Binding}"
              DefaultTemplate="{StaticResource XySeriesRolloverLabelTemplate}"
              OhlcSeriesTemplate="{StaticResource OhlcSeriesRolloverLabelTemplate}" />
    </Border>
</ControlTemplate>

I would suggest something like that. The SeriesInfoTemplateSelector is a public class within ScIChart and literally just serves the correct DataTemplate for the tooltip based on what type of SeriesInfo is passed in.

UPDATE 2014:
The TooltipLabelTemplateSelector property has been exposed in the TooltipModifierBase class, so it is inherited by the Rollover, Cursor and TooltipModifier.

Let me know how you get on with this. I’m interested to see if it works!

Best regards,
Andrew

  • You must to post comments
0
0

Update

We have now implemented this behaviour into the RolloverModifier natively in SciChart v4.

Please see the SciChart WPF RolloverModifier Documentation.

1.) The RolloverModifier.TooltipTemplate attached property is declared on the series, so you can have a custom tooltip template per series. Before you needed a DataTemplateSelector. This is no longer necessary.

2.) The RolloverModifier.IncludeSeries attached property allows you to include or exclude a specific series from the RolloverModifier.

Best regards,
Andrew

  • You must to post comments
Showing 2 results
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