Adding Annotation to Chart

Hello,

I want to draw a dotted line in the chart, I'm trying out annotation for this purpose.

I'm not sure annotation is the right way to draw line in a chart (Please suggest a better approach if there are any)

I've attached the code that I'm trying, can you please check

The line should start at pt x = '0' y=50 and should extend till the end.

https://plnkr.co/edit/fODz8TtOnAdQBUNSY78a?p=preview

 
               
 



3 Replies

BP Baby Palanidurai Syncfusion Team March 16, 2018 10:03 AM UTC

Hi Manu, 

Thanks for using syncfusion products. 

We have analyzed your query and we like to inform you that, coordinateUnits has 2 values. 
  1. Pixel
  2. Point
Pixel: x and y values consider as pixel based on `region` property whether it depends on `Chart`(placed the annotation element with respect to container) or `Series` (Placed the annotation element with respect to chart area). 
Point: x is represented as series points(x and y). 
In your scenario, you have used coordinateUnits as Pixel that’s why the annotation has been rendered on that position. We have suggest to use coordinate unit as `Point` instead of `Pixel` and set the point value to x and y. 
Please find the below code snippet to achieve your exact requirement, 

Code Snippet: 

<e-annotation visible = true 
                    content='<div id = "test" style="border-top:3px dashed grey;border-top-width: 2px; width: 10000px"></div>'  
                    x = 2014 y = 50  
                    coordinateUnits='Point'
                </e-annotation> 
 

Screenshot: 
 

We have modified your sample based on this. Please find the sample from below link, 


Kindly revert us, if you have any concerns. 

Thanks, 
Baby. 



MA Manu March 28, 2018 08:16 PM UTC

Hello, 

For annotations, if I set the visible property to false, its not hidding the annotation.
whats the right way to adjust the visibility of the annotation

<e-annotation visible = false
                    content='<div id = "test" style="border-top:3px dashed grey;border-top-width: 2px; width: 10000px"></div>'  
                    x = 2014 y = 50
                    coordinateUnits='Point'
                </e-annotation> 


BP Baby Palanidurai Syncfusion Team March 29, 2018 06:38 AM UTC

Hi Manu, 

     We have analyzed your query. As of now, we are not providing visible option for annotation. The annotation for chart will get visible/hide based on the content. So, If you want to hide the annotation, you can set null value for content property as below. 

<e-annotations> 
                <e-annotation 
                    content=null  
                    x = 2014 y = 50  
                    coordinateUnits='Point'> 
                </e-annotation> 

Screenshot: 
 
Sample for your reference can be find from below link, 

kindly revert us, if you have any concerns. 

Thanks 
Baby

Loader.
Up arrow icon