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.

0
0

Hello guys

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

Images
  • You must to post comments
0
0

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"
                Background="#333"
                BorderBrush="#FFF"
                BorderThickness="1"
                CornerRadius="2">
            <TextBlock Foreground="#FFF" Text="{Binding CursorFormattedDataValue}" />
        </Border>
    </ControlTemplate>

Hope this helps!

Yuriy

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

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.