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

Adding Labels

How to add labels for the graph. Refer to the screenshot attached.



Thank you.

1 Reply

DD Dharanidharan Dharmasivam Syncfusion Team October 23, 2019 09:52 AM UTC

Hi Mayur, 
 
Thanks for using Syncfusion Flutter chart widget. Your requirement can be achieved using the annotation feature. Using the annotation feature you can add the widgets on the chart. In the below code, we have added a text, and this can be modified based on your scenario. 
 
 
SfCartesianChart( 
                  annotations: <CartesianChartAnnotation>[ 
                    CartesianChartAnnotation( 
                        widget: Container( 
                            child: const Text('Annotation', 
                                style: TextStyle(fontSize: 18))), 
                        coordinateUnit: CoordinateUnit.point, 
                        region: AnnotationRegion.plotArea, 
                        // Here if your x-axis is rendered as category axis and coordinateUnit is point, then in the                           
                            x attribute you can either specify the index value of the point else directly specify the   
                             x value as below. 
                        x: 'Fri', 
                        y: 28), 
                  ], 
), 
 
 
 
For your convenience, we have prepared a sample and more information on the annotation feature find the user guide. 
 
Thanks, 
Dharani. 


Loader.
Live Chat Icon For mobile
Up arrow icon