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

1
0

Hi there

How to change crosshair’s and rollover’s tooltip, in particular lowest to low and highest to high?

  • You must to post comments
1
0

Hi,

You need to set RolloverLabelTemplate, CursorLabelTemplate properties. Here is the template which is used by default:

    <ControlTemplate x:Key="CursorLabelTemplate" TargetType="s:TemplatableControl">
        <Border Background="{Binding Path=CursorLabelBackgroundBrush,
                                     Source={z:Static Member=s:ThemeManager.ThemeProvider}}"
                BorderBrush="{Binding Path=CursorLabelBorderBrush,
                                      Source={z:Static Member=s:ThemeManager.ThemeProvider}}"
                BorderThickness="1"
                CornerRadius="5">

            <ItemsControl Margin="6" ItemsSource="{Binding SeriesData.SeriesInfo}" ItemTemplate="{StaticResource OhlcSeriesRolloverLabelTemplate}">
            </ItemsControl>
        </Border>
    </ControlTemplate>

    <!--  Template for the RolloverModifier tooltip to display AxisInfo collection (result of hit test)  -->
    <DataTemplate x:Key="OhlcSeriesRolloverLabelTemplate">

        <Grid>
            <Grid.RowDefinitions>
                <RowDefinition Height="Auto" />
                <RowDefinition />
            </Grid.RowDefinitions>
            <Grid.ColumnDefinitions>
                <ColumnDefinition />
                <ColumnDefinition Width="Auto" />
            </Grid.ColumnDefinitions>

            <TextBlock Grid.ColumnSpan="2"
                       HorizontalAlignment="Left"
                       Style="{StaticResource HintDataItemsStyle}"
                       Text="{Binding SeriesName}"
                       Visibility="{Binding SeriesName,
                                            Converter={StaticResource CollapseIfNullOrEmptyStringConverter}}" />

            <StackPanel Grid.Row="1">
                <TextBlock HorizontalAlignment="Left"
                           Style="{StaticResource HintDataItemsStyle}"
                           Text="Open" />
                <TextBlock HorizontalAlignment="Left"
                           Style="{StaticResource HintDataItemsStyle}"
                           Text="Highest" />
                <TextBlock HorizontalAlignment="Left"
                           Style="{StaticResource HintDataItemsStyle}"
                           Text="Lowest" />
                <TextBlock HorizontalAlignment="Left"
                           Style="{StaticResource HintDataItemsStyle}"
                           Text="Close" />
            </StackPanel>

            <StackPanel Grid.Row="1" Grid.Column="1">
                <TextBlock HorizontalAlignment="Left"
                           Style="{StaticResource HintDataItemsStyle}"
                           Text="{Binding OpenValue,
                                          StringFormat=\{0:0.000\}}" />
                <TextBlock HorizontalAlignment="Left"
                           Style="{StaticResource HintDataItemsStyle}"
                           Text="{Binding HighValue,
                                          StringFormat=\{0:0.000\}}" />
                <TextBlock HorizontalAlignment="Left"
                           Style="{StaticResource HintDataItemsStyle}"
                           Text="{Binding LowValue,
                                          StringFormat=\{0:0.000\}}" />
                <TextBlock HorizontalAlignment="Left"
                           Style="{StaticResource HintDataItemsStyle}"
                           Text="{Binding CloseValue,
                                          StringFormat=\{0:0.000\}}" />
            </StackPanel>
        </Grid>
    </DataTemplate>

You should modify this or create your own template, to override default one.

Hope this helps!

Best regards,
Yuriy

  • VRueda
    HiCan you help me override your template from code? Shall i use xamlreader.parse? Or put xaml template in resources then find it by FindResource?
  • Yuriy
    Please, find useful information on this topic here: How to generate rollover marker template in code.Best regards, Yuriy
  • You must to post comments
Showing 1 result
Your Answer

Please first to submit.