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

Add data label dynamically


How do you add data labels to a series dynamically?


1 Reply

DD Dharanidharan Dharmasivam Syncfusion Team March 18, 2019 08:56 AM UTC

Hi Rikard, 
Greetings from Syncfusion.  
We have analyzed your requirement. We suspect that, your requirement is to bind the data for data label from data source dynamically. If so, using the name property in dataLabel, you can map the field from your data source. For more information on data label, find the user guide.  
Find the code snippet below to achieve this requirement. 
<ejs-accumulationchart id="pieChart"> 
      <e-accumulationseries-datalabel visible="true" name="text"></e-accumulationseries-datalabel> 
List<LineChartData> chartData = new List<LineChartData> 
                new LineChartData { xValue = "X1", yValue = 21, text = "X1 Data" }, 
            ViewBag.dataSource = chartData; 
If this is not your exact requirement, kindly provide more information on your query. This will be much helpful in further analysis and provide you the solution sooner. 

Live Chat Icon For mobile
Up arrow icon