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

Welcome to the SciChart Community Forums!

Please use the forums below to ask questions about SciChart. Take a moment to read our Question asking guidelines on how to ask a good question and our support policy. We also have a tag=SciChart on Stackoverflow.com where you can earn rep for your questions!

Please note: SciChart team will only answer questions from customers with active support subscriptions. Expired support questions will be ignored. If your support status shows incorrectly, contact us and we will be glad to help.

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.