Disable dragging on Axismarker

Hi.

I'm using a HorizontalLineAnnotation that is draggable. And when i enable AxisLabel on the line, the label becomes draggable too. And while i really do like the AxisLabel, i need to disable the draggable feature on the label.

So my question is this: Can i disable draggable on the AxisLabel, but not the HorizontalLineAnnotation. So only the HorizontalLineAnnotation is draggable?

My reason for asking, is that i have several Annotation pairs that i need to keep track of and move when a given HorizontalLineAnnotation is dragged - and only the HorizontalLineAnnotation is draggeble.
So i cast the sender of the DragDelta event to a HorizontalLineAnnotation where after i find this component in my list of annotation pairs, and adjust all annotations associated with this line.

But when its the label that is dragged, a AxisMarker object is returned as sender. And since i have no previous knowledge of what HorizontalLineAnnotation the given axismarker is attached to, i cannot find the associated annotations that needs to update.

/edit

If i can somehow link the AxisMarker to the associated HorizontalLineAnnotation that would be fine too.
But there is to my knowledge no access to the AxisMarker object in the HorizontalLineAnnotation?

/edit


Kind regards

Thomas



1 Reply

YP Yuvaraj Palanisamy Syncfusion Team April 14, 2022 05:49 AM UTC

Hi Thomas,


We have analyzed your query “Drag the HorizontalLineAnnotation and without drag it’s AxisMarker” and you can achieve this by adding additional HorizontalLineAnnotation as per the below code example.


CodeSnippet:

<syncfusion:SfChart.Annotations>

    <syncfusion:HorizontalLineAnnotation X1="1" Y1="1" X2="6"  Y2="5" CanDrag="True" StrokeThickness="2" Stroke="Red"/>

    <syncfusion:HorizontalLineAnnotation X1="1" Y1="1" X2="1" ShowAxisLabel="True"/>

 

    <syncfusion:HorizontalLineAnnotation X1="3" Y1="4" X2="7"  Y2="5" CanDrag="True" StrokeThickness="2" Stroke="Green"/>

    <syncfusion:HorizontalLineAnnotation X1="3" Y1="4" X2="3" ShowAxisLabel="True"/>

</syncfusion:SfChart.Annotations>


We have attached the sample for your reference. Please find the sample from the below attachment.


Output:


Please let us know if you have any concern.


Regards,

Yuvaraj.


Attachment: SampleAnnotation_f9e9dedb.zip

Loader.
Up arrow icon