Pre loader

Center point marker on category axis

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


I have built a file availability chart displaying point markers for dates. The marker is being displayed on the left-most edge for each category. The effect is that when the user hovers directly over a marker it will often shown the wrong date in the mouse over label. Is there a way to center the point marker alignment with the category axis?

I’m using WPF version 3.4

  • You must to post comments

I think this is a rounding issue. The marker itself is centered on the X,Y point that you display, but the cursor won’t snap to the middle of the point so as you move the cursor over the point itself, there is some ‘give’ in the values it displays.

You may be able to force rounding to the nearest day by using a Converter inside an Axis Label Template, e.g. from our Documentation:

CursorModifier Axis Labels come with a default style. This style can be overridden by setting the CursorModifier.AxisLabelContainerStyle and/or CursorModifier.AxisLabelTemplate attached properties on the relevant axis.
For example:

<!-- Demonstrates custom cursor axis label style --> 
      <!-- This is the style for the control that hosts the Axis Label --> 
      <Style x:Key="CursorModAxisLabelStyle" TargetType="s:AxisLabelControl">
         <Setter Property="Background" Value="#AAFF6600" />
         <Setter Property="BorderBrush" Value="#FFFF6600" />
         <Setter Property="BorderThickness" Value="1" />

      <!-- This is the DataTemplate for the Axis Label. DataContext is AxisInfo -->
      <DataTemplate x:Key="CursorModAxisLabelTemplate" DataType="s:AxisInfo">
            <TextBlock Foreground="White" FontFamily="Arial" FontSize="11" Margin="2"
                       Text="{Binding DataValue, StringFormat='{}{0:0.00}'}" />

   <!--  Declare Axes with CursorLabelTemplates -->
      <s:NumericAxis s:CursorModifier.AxisLabelContainerStyle="{StaticResource CursorModAxisLabelStyle}" 
                     s:CursorModifier.AxisLabelTemplate="{StaticResource CursorModAxisLabelTemplate}" />

      <s:NumericAxis s:CursorModifier.AxisLabelContainerStyle="{StaticResource CursorModAxisLabelStyle}" 
                     s:CursorModifier.AxisLabelTemplate="{StaticResource CursorModAxisLabelTemplate}" />

         <s:CursorModifier ShowAxisLabels="true"/>


There’s a StringFormat in the CursorModAxisLabelTemplate but you could easily replace this for a Converter which rounds to the nearest date.

Let me know if this helps,

  • 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