Pre loader

CursorModifier - Getting the different tooltip values

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

0
0

I have a chart with the CursorModifier setting on. This CursorModifier shows the y-coordinate values of all the curves, as tooltips on the graph surface.

Is it possible to programmatically get these values in C# code, so as to display them in another part of the window simultaneously?

Version
6.4
  • You must to post comments
0
0

H Amarnath,

Yes you can. The CursorModifier, RolloverModifier and TooltipModifier expose a property called SeriesData.

They all work the same way. If you look at the RolloverModifier documentation we have an example.

Consuming RolloverModifier.SeriesData in an ItemsControl

You can create a RolloverModifier legend in a few lines of XAML. Here is ours, below:

            <Border Grid.Column="1" Margin="23,23" HorizontalAlignment="Left"
                VerticalAlignment="Top" Background="#77222222"
                BorderBrush="#323539" BorderThickness="2" Padding="5">
 <Border.Effect>
    <DropShadowEffect BlurRadius="10" ShadowDepth="5"
                        Color="Black" Direction="-45"/>
 </Border.Effect>
 <ItemsControl ItemsSource="{Binding ElementName=RolloverModifier,
                                      Path=SeriesData.SeriesInfo}">
    <ItemsControl.ItemTemplate>
       <DataTemplate>
          <Grid>
             <Grid.ColumnDefinitions>
                <ColumnDefinition />
                <ColumnDefinition />
                <ColumnDefinition />
             </Grid.ColumnDefinitions>

             <!--  Bind to the SeriesName using the Stroke as foreground  -->
             <TextBlock Grid.Column="0"
                      Margin="3,3,20,3"
                      FontSize="13"
                      FontWeight="Bold"
                      Foreground="{Binding Stroke,
                             Converter={StaticResource ColorToBrushConverter}}"
                      Text="{Binding SeriesName}" />

             <!--  Bind to the Series Value, using the Stroke as foreground-->

             <!--  When binding to XValue, YValue of type IComparable, StringFormat
             <!-- is mandatory due to a  -->
             <!--  XAML bug that cannot convert IComparable to text, even though
             <!-- underlying type is double  -->
             <StackPanel Grid.Column="1"
                      Margin="3,3,20,3"
                      Orientation="Horizontal">
                <TextBlock FontSize="13"
                         FontWeight="Bold"
                         Foreground="{Binding Stroke,
                          Converter={StaticResource ColorToBrushConverter}}"
                         Text="{Binding XValue,
                                    StringFormat=X: \{0:0.00\}}" />
             </StackPanel>
             <StackPanel Grid.Column="2"
                      Margin="3,3,20,3"
                      Orientation="Horizontal">
                <TextBlock FontSize="13"
                         FontWeight="Bold"
                         Foreground="{Binding Stroke,
                          Converter={StaticResource ColorToBrushConverter}}"
                         Text="{Binding YValue,
                                    StringFormat=Y: \{0:0.00\}}" />
             </StackPanel>

          </Grid>
       </DataTemplate>
    </ItemsControl.ItemTemplate>
 </ItemsControl>

Best regards,
Andrew

  • 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