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

Use doughnut char with Angular


Can you guide me  how to use a chart of type doughnut using angular?. Also when a new set of points is loaded I need to use .redraw() to refresh the graph?


1 Reply

AT Anandaraj T Syncfusion Team December 15, 2016 11:40 AM UTC

Hi Roberto, 


Thanks for using Syncfusion products. 


Query #1: Can you guide me how to use a chart of type doughnut using angular? 

We have created a simple doughnut chart sample using angular directive with option to dynamically update the data source. The sample is available in the following link 



Please refer the following code snippet to achieve this 



<div id="container" ej-chart style="width: 60%; float: left;" 






<e-series name="Doughnut Demo" type="doughnut" e-datasource="nChartData" 

e-xname="x" e-yname="y"> 





Query #2: Also when a new set of points is loaded I need to use .redraw() to refresh the graph? 


Essential JavaScript Chart supports two way binding with angular JS. If points are updated through scope variables, then chart will be updated automatically. We can use redraw method when points are not updated through scope variable. 


Please refer the following code snippet to update using redraw method 



function UpdateChart() { 

//Get Chart instance 

var chart = $('#container').ejChart('instance'); 


//Change the data source 

chart.model.series[0].dataSource = chart.model.series[0].dataSource.length == 5 ? data10 : data5; 


//Redraw the chart 




Note: In above example, two way binding is used to update chart through combo box 


Please let us know if you have any concern. 




SIGN IN To post a reply.
Live Chat Icon For mobile
Up arrow icon