Annotation

24 Feb 202214 minutes to read

The annotations are used to mark the specific area of interest in the chart area with texts, shapes or images.

By using the content option of annotation property, you can specify the Id of the element that needs to be displayed in the chart area.

<ejs-accumulationchart id="container" title="Mobile Browser Statistics">
                    <e-accumulationchart-legendsettings visible="false">
                    </e-accumulationchart-legendsettings>
                    <e-accumulation-series-collection>
                        <e-accumulation-series dataSource="ViewBag.dataSource" xName="xValue" yName="yValue" name="Browser">
                        </e-accumulation-series>
                    </e-accumulation-series-collection>
                    <e-accumulationchart-accumulationannotations>
                        <e-accumulationchart-accumulationannotation Content="<div style='border: 1px solid black;background-color:red;padding: 5px 5px 5px 5px'>Others</div>" X="iPhone" Y=19 CoordinateUnits='@Syncfusion.EJ2.Charts.Units.Point' region='@Syncfusion.EJ2.Charts.Regions.Series' ></e-accumulationchart-accumulationannotation>
                    </e-accumulationchart-accumulationannotations>
                </ejs-accumulationchart>
public ActionResult Index()
        {
            List<PieChartData> chartData = new List<PieChartData>
            {

                new PieChartData { x = "Chrome", y = 37 },
                new PieChartData { x = "UC Browser", y = 17 },
                new PieChartData { x = "iPhone", y = 19 },
                new PieChartData { x = "Others", y = 4  },
                new PieChartData { x = "Opera", y = 11 },
                new PieChartData { x = "Android", y = 12 },
            };
            ViewBag.dataSource = chartData;
           return View();
        }
        public class PieChartData
        {
            public string xValue;
            public double yValue;
        }

Region

The annotation can be placed with respect to either Series or Chart.

<ejs-accumulationchart id="container" title="Mobile Browser Statistics">
                    <e-accumulationchart-legendsettings visible="false">
                    </e-accumulationchart-legendsettings>
                    <e-accumulation-series-collection>
                        <e-accumulation-series dataSource="ViewBag.dataSource" xName="xValue" yName="yValue" name="Browser">
                        </e-accumulation-series>
                    </e-accumulation-series-collection>
                    <e-accumulationchart-accumulationannotations>
                        <e-accumulationchart-accumulationannotation Content="<div style='border: 1px solid black;background-color:red;padding: 5px 5px 5px 5px'>Others</div>" X="iPhone" Y=19 CoordinateUnits='@Syncfusion.EJ2.Charts.Units.Pixel' region='@Syncfusion.EJ2.Charts.Regions.Chart'></e-accumulationchart-accumulationannotation>
                    </e-accumulationchart-accumulationannotations>
                </ejs-accumulationchart>
public ActionResult Index()
        {
             List<PieChartData> chartData = new List<PieChartData>
            {

                new PieChartData { x = "Chrome", y = 37 },
                new PieChartData { x = "UC Browser", y = 17 },
                new PieChartData { x = "iPhone", y = 19 },
                new PieChartData { x = "Others", y = 4  },
                new PieChartData { x = "Opera", y = 11 },
                new PieChartData { x = "Android", y = 12 },
            };
            ViewBag.dataSource = chartData;
            return View();
        }
        public class PieChartData
        {
            public string xValue;
            public double yValue;
        }

Co-ordinate Units

Specifies the coordinate units of an annotation either in Pixel or Point.

<ejs-accumulationchart id="container" title="Mobile Browser Statistics">
                    <e-accumulationchart-legendsettings visible="false">
                    </e-accumulationchart-legendsettings>
                    <e-accumulation-series-collection>
                        <e-accumulation-series dataSource="ViewBag.dataSource" xName="xValue" yName="yValue" name="Browser">
                        </e-accumulation-series>
                    </e-accumulation-series-collection>
                    <e-accumulationchart-accumulationannotations>
                        <e-accumulationchart-accumulationannotation Content="<div style='border: 1px solid black;background-color:red;padding: 5px 5px 5px 5px'>Others</div>" X="iPhone" Y=19 CoordinateUnits='@Syncfusion.EJ2.Charts.Units.Pixel' region='@Syncfusion.EJ2.Charts.Regions.Chart'></e-accumulationchart-accumulationannotation>
                    </e-accumulationchart-accumulationannotations>
                </ejs-accumulationchart>
public ActionResult Index()
        {
            List<PieChartData> chartData = new List<PieChartData>
            {

                new PieChartData { x = "Chrome", y = 37 },
                new PieChartData { x = "UC Browser", y = 17 },
                new PieChartData { x = "iPhone", y = 19 },
                new PieChartData { x = "Others", y = 4  },
                new PieChartData { x = "Opera", y = 11 },
                new PieChartData { x = "Android", y = 12 },
            };
            ViewBag.dataSource = chartData;
             return View();
        }
        public class PieChartData
        {
            public string xValue;
            public double yValue;
        }

Alignment

The annotations can be moved vertically and horizontally from its default position by using verticalAlignment or horizontalAlignment properties. The verticalAlignment property takes value as Top, Bottom or Middle and the horizontalAlignment property takes value as Near, Far or Center.

<ejs-accumulationchart id="container" title="Mobile Browser Statistics">
                    <e-accumulationchart-legendsettings visible="false">
                    </e-accumulationchart-legendsettings>
                    <e-accumulation-series-collection>
                        <e-accumulation-series dataSource="ViewBag.dataSource" xName="xValue" yName="yValue" name="Browser">
                        </e-accumulation-series>
                    </e-accumulation-series-collection>
                    <e-accumulationchart-accumulationannotations>
                        <e-accumulationchart-accumulationannotation Content="<div style='border: 1px solid black;background-color:red;padding: 5px 5px 5px 5px'>Others</div>" X="iPhone" Y=19 CoordinateUnits='@Syncfusion.EJ2.Charts.Units.Pixel' region='@Syncfusion.EJ2.Charts.Regions.Chart' verticalAlignment="Top" horizontalAlignment="Near"></e-accumulationchart-accumulationannotation>
                    </e-accumulationchart-accumulationannotations>
                </ejs-accumulationchart>
public ActionResult Index()
        {
            List<PieChartData> chartData = new List<PieChartData>
            {

                new PieChartData { x = "Chrome", y = 37 },
                new PieChartData { x = "UC Browser", y = 17 },
                new PieChartData { x = "iPhone", y = 19 },
                new PieChartData { x = "Others", y = 4  },
                new PieChartData { x = "Opera", y = 11 },
                new PieChartData { x = "Android", y = 12 },
            };
            ViewBag.dataSource = chartData;
            return View();
        }
        public class PieChartData
        {
            public string xValue;
            public double yValue;
        }