Pre loader

How to create a Tooltip Template for the X-Axis tooltip in the Rollover Modifier

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
0
0

To whom this may concern:

I was successfully able to create a rollover modifier tooltip template for the actual data, as shown in the attached screenshot.

You can see the red arrow shows that the X-Axis tooltip is still the default style. I would like for it to be the same style as the tooltip templates circled in green.

I have tried using the AxisLabelTemplate dependency property, but the tooltips show up on the Y-Axes as well, and I don’t know how to bind it to the X-Axis Value.

Can you please advise?

Thanks kindly!

— Ari

Images
  • You must to post comments
Best Answer
0
0

Hi ari,

In SciChart v4, this is now quite simple. From our RolloverModifier Documentation;

The RolloverModifier displays an optional XAxis Label which can be shown or hidden by changing the RolloverModifier.ShowAxisLabels property.

If you wish to change the Axis Label template, then you need to set the RolloverModifier.AxisLabelTemplate attached property on an Axis instance.

If you wish to change the container style for the Axis Label, then you need to set the RolloverModifier.AxisLabelStyle attached property on the Axis instance.

For example, the following code:

<s:SciChartSurface>
    <s:SciChartSurface.Resources>
        <!-- Style applied to axis label, TargetType is AxisLabelControl -->
        <Style x:Key="AxisLabelStyle" TargetType="s:AxisLabelControl">
            <Setter Property="Background" Value="CornflowerBlue" />
            <Setter Property="BorderBrush" Value="Blue" />
        </Style>
        <!-- Item template. DataContext is AxisInfo type -->
        <DataTemplate x:Key="AxisLabelTemplate" DataType="s:AxisInfo">
            <StackPanel >
                <TextBlock Text="{Binding AxisId, StringFormat='{}AxisId : {0}'}" />
                <TextBlock Text="{Binding DataValue, StringFormat='{}Val : {0}'}" />
            </StackPanel>
        </DataTemplate>
    </s:SciChartSurface.Resources>

    <!-- Define the RolloverModifier XAxis Label style on the axis -->
    <s:SciChartSurface.XAxis>
        <s:NumericAxis s:RolloverModifier.AxisLabelStyle="{StaticResource AxisLabelStyle}" s:RolloverModifier.AxisLabelTemplate="{StaticResource AxisLabelTemplate}"/>
    </s:SciChartSurface.XAxis>
    <s:SciChartSurface.YAxis>
        <s:NumericAxis />
    </s:SciChartSurface.YAxis>
    <s:SciChartSurface.ChartModifier>
        <s:ModifierGroup>
            <s:RolloverModifier />
        </s:ModifierGroup>
    </s:SciChartSurface.ChartModifier>
</s:SciChartSurface>

Best regards,
Andrew

  • Ari Sagiv
    Yep, I had updated to SciChart v. 4 and figured that out :-) Thank you!
  • Andrew Burnett-Thompson
    Great! sounds like the new API is intuitive, which is what we wanted!! :)
  • 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