Pre loader

Questions about CursorModifier

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 enabled the cursor to get the coordinates of the mouse. The code is very straightforward – attachment CursorModifier.txt.

The result is show in screenshot CursorModifier.png

(1) How can I disable the x-axis cursor and show only y-axis coordinate values?
(2) According to the code, the font size should be 16pt and the background should be yellow. This is not the case (attachment CursorModifier.png). How can I control these properties?
(3) If I decide to keep x-axis cursor, how v]=can I display the custom content which will be based on the mapping between the current value of X and the array or strings, ex. round up 28.858819 -> 29 and display string[29].

Attachments
Images
  • You must to post comments
0
0

Hello,

Thank you for your enquiry! Most of your questions can be answered by the CursorModifier Documentation.

It’s not possible to hide just the XAxis label (and not the Y) but it is possible to change the FontSize and the decimal places and color of the Axis Labels as follows. See the section titled Styling the Axis Labels.

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.

<!-- Demonstrates custom cursor axis label style -->
<s:SciChartSurface>
   <s:SciChartSurface.Resources>     
      <!-- 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" />
      </Style>

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

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

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

   <s:SciChartSurface.ChartModifier>
      <s:ModifierGroup>        
         <s:CursorModifier ShowAxisLabels="true"/>
      </s:ModifierGroup>
   </s:SciChartSurface.ChartModifier>

</s:SciChartSurface>

Let me know if this helps,

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