We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date
close icon

Vertical line annotation text issue and move issue

Hi, 

I am using vertical line annotation in chart. But If I click on the line drawn and drag the mouse then line moves along with mouse on graph. Is there any way to stop this line moving from its original place?

Also I am assigning some text to vertical line annotation with text allignment set to 'Right'. I am using 5 different vertical line annotations with different text but same settings else where. But the distance between line and text is different for different text. How can I control that distance between text and Line.

3 Replies

MK Muneesh Kumar G Syncfusion Team May 27, 2019 11:10 AM UTC

Hi Akshay, 
 
Thanks for using Syncfusion products. Please find the details below.  

 
Query 1: Is there any way to stop this line moving from its original place? 
 
You can achieve this by setting CanDrag as false in annotation as per the below code snippet.  
 
Code snippet 
<chart:SfChart.Annotations> 
                <chart:VerticalLineAnnotation X1="1" Text="Annotation " CanDrag="False" 
                                              HorizontalTextAlignment="Right" /> 
.. 
 
 
 
Query 2: Also, I am assigning some text to vertical line annotation with text allignment set to 'Right'. I am using 5 different vertical line annotations with different text but same settings else where. But the distance between line and text is different for different text. How can I control that distance between text and Line. 
 
We have checked the reported scenario with our sample, it works fine. Please check the sample from the following location.  
 
 
Screenshot:  
 
 
If you still face any problem, can you revert us by modifying the attached sample based on your application scenario, this will help us to provide you a better solution at the earliest.  

Regards,
Muneesh Kumar G.
 



AJ Akshay Joglekar May 30, 2019 02:10 PM UTC

Thank you so much for your help!!

I will try your given solution and get back to you with the results. Just One question 

"Is there any way to set position of the text of Vertical annotation at the bottom of graph?"


MK Muneesh Kumar G Syncfusion Team May 31, 2019 12:18 PM UTC

Hi Akshay, 
 
Thanks for your update, we have analyzed your requirement and you can achieve this by setting ContentTemplate for annotation and setting Margin for text element as per the below code snippet.  
 
Code snippet 
 
  <chart:SfChart.Annotations> 
                <chart:VerticalLineAnnotation X1="1" CanDrag="False" > 
                    <chart:VerticalLineAnnotation.ContentTemplate> 
                        <DataTemplate> 
                            <TextBlock Text="Annotation" Margin="-200,0,0,0"/> 
                        </DataTemplate> 
                    </chart:VerticalLineAnnotation.ContentTemplate> 
                </chart:VerticalLineAnnotation> 
                <chart:VerticalLineAnnotation X1="2" CanDrag="False"   > 
                    <chart:VerticalLineAnnotation.ContentTemplate> 
                        <DataTemplate> 
                            <TextBlock Text="Annotation Text" Margin="-200,0,0,0"/> 
                        </DataTemplate> 
                    </chart:VerticalLineAnnotation.ContentTemplate> 
                </chart:VerticalLineAnnotation> 
                <chart:VerticalLineAnnotation X1="3" CanDrag="False" > 
                    <chart:VerticalLineAnnotation.ContentTemplate> 
                        <DataTemplate> 
                            <TextBlock Text="Annotation Text Text" Margin="-200,0,0,0"/> 
                        </DataTemplate> 
                    </chart:VerticalLineAnnotation.ContentTemplate> 
                </chart:VerticalLineAnnotation> 
                <chart:VerticalLineAnnotation X1="4" CanDrag="False"   > 
                    <chart:VerticalLineAnnotation.ContentTemplate> 
                        <DataTemplate> 
                            <TextBlock Text="Text" Margin="-200,0,0,0"/> 
                        </DataTemplate> 
                    </chart:VerticalLineAnnotation.ContentTemplate> 
                </chart:VerticalLineAnnotation> 
            </chart:SfChart.Annotations> 
 
Screenshot:  
 
 
 
Regards, 
Muneesh Kumar G. 


Loader.
Live Chat Icon For mobile
Up arrow icon