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


Hello guys

How to change Crosshair annotation string format?
I need to round it to decimals. shall i make new Control Template?

  • You must to post comments

The CursorModifier gets its data from the Axis, see the method AxisBase.HitTest, which has this signature:

/// <summary>
/// Performs a hit test on the Axis, returning the Data Value at the specific x or y pixel coordinate. This operation is the opposite of <see cref="AxisBase.GetCoordinate"/>
/// </summary>
/// <param name="atPoint">The pixel coordinate on this Axis corresponding to the input DataValue</param>
/// <returns>An <see cref="AxisInfo"/> struct containing the datavalue and formatted data value at this coordinate</returns>
/// <remarks></remarks>
public override AxisInfo HitTest(Point atPoint);

The HitTest method on NumericAxis uses the AxisBase.TextFormatting and AxisBase.CursorTextFormatting properties to format strings (for axis and for cursor labels).

Please try changing YAxis.CursorTextFormatting and let me know if that updates your cursor label output.

Alternatively, if you do need to template the cursor axis labels, you can do so by setting the CursorModifier.CursorAxesLabelTemplate property with a custom template. Don’t worry, this one’s pretty short and sweet:

    <!--  Template for the CursorModifier axes tooltips to display AxisInfo collection (result of hit test)  -->
    <ControlTemplate x:Key="CursorAxesLabelTemplate" TargetType="SciChart:TemplatableControl">
        <Border Margin="1"
            <TextBlock Foreground="#FFF" Text="{Binding CursorFormattedDataValue}" />

Hope this helps!


  • VRueda
    Hello, Yuriy Thanks, now it works Only IAxis.TextFormatting needed
  • You must to post comments

Update: SciChart v4

The SciChart v4 Documentation now has a topic on styling the CursorModifier Tooltips, Lines and Axis Labels. You can see this here:

> How to style the CursorModifier Tooltips

Also, you can learn how to styling and configuring the CursorModifier Tooltips and Axis Labels in the following example:

> Styling CursorModifier Tooltips WPF Chart Example

enter image description here

  • You must to post comments
Showing 2 results
Your Answer

Please first to submit.