User interaction with annotation
Hi Praveen,
We have taken your query regarding support for Interactive Annotation in CartesianChart into consideration and add it to in our request list. You can status or progress of the support in the following feedback link.
Feedback - Provide Support for Interactive Annotations in .NET MAUI Cartesian Chart
We will prioritize the features in every release based on the demands, and we do not have an immediate plan to implement this since we committed to already planned work. So, this feature will be available for any of our upcoming releases.
However, we would like to inform you that we have provided a workaround to show horizontal and vertical lines annotation at the touch move points by extending the ChartInteractionBehavior. We have included a code snippet and a sample for your reference.
Please find the attached code and sample to see the implementation.
|
<chart:SfCartesianChart.InteractiveBehavior> <model:ChartInteractionExt TouchMoveEvent="ChartInteractionExt_TouchMoveEvent"/> </chart:SfCartesianChart.InteractiveBehavior> |
|
<chart:SfCartesianChart.Annotations> <chart:HorizontalLineAnnotation x:Name="Horizontal" ShowAxisLabel="True"> <chart:HorizontalLineAnnotation.AxisLabelStyle> <chart:ChartAxisLabelStyle LabelFormat="#.##" Background="Orange"></chart:ChartAxisLabelStyle> </chart:HorizontalLineAnnotation.AxisLabelStyle> </chart:HorizontalLineAnnotation> <chart:VerticalLineAnnotation x:Name="Vertical" ShowAxisLabel="True"> <chart:VerticalLineAnnotation.AxisLabelStyle> <chart:ChartAnnotationLabelStyle LabelFormat="#.##" Background="Orange"/> </chart:VerticalLineAnnotation.AxisLabelStyle> </chart:VerticalLineAnnotation> </chart:SfCartesianChart.Annotations> |
|
private void ChartInteractionExt_TouchMoveEvent(object sender, TouchMoveEventArgs e) { bool inSeriesBounds = chart.SeriesBounds.Contains(e.PointX, e.PointY);
if (inSeriesBounds) { var x = chart.PointToValue(xAxis, e.PointX, e.PointY); var y = chart.PointToValue(yAxis, e.PointX, e.PointY); Horizontal.Y1 = y; Vertical.X1 = x; }
} |
Please cast your vote to make it count, and if you have any more specifications or suggestions for the feature request, you can add them as a comment in the feedback portal.
Regards,
Nitheeshkumar.
Attachment: InteractiveAnnotationSample_22125f5d.zip
- 1 Reply
- 2 Participants
-
PD Praveen D
- Sep 10, 2024 10:18 PM UTC
- Sep 11, 2024 02:04 PM UTC