Hello guys
How to change Crosshair annotation string format?
I need to round it to decimals. shall i make new Control Template?
- VRueda asked 11 years ago
- You must login 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" Background="#333" BorderBrush="#FFF" BorderThickness="1" CornerRadius="2"> <TextBlock Foreground="#FFF" Text="{Binding CursorFormattedDataValue}" /> </Border> </ControlTemplate>
Hope this helps!
Yuriy
- Yuriy Zadereckiy answered 11 years ago
-
Hello, Yuriy Thanks, now it works Only IAxis.TextFormatting needed
- You must login 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:
Also, you can learn how to styling and configuring the CursorModifier Tooltips and Axis Labels in the following example:
- Andrew Burnett-Thompson answered 8 years ago
- You must login to post comments
Please login first to submit.