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

Create chart dynamically


I need to create a chart dynamically in javascript for my ASP .NET Core project, but I cannot find any documentation on how to achieve this but only how to create a chart in a .cshtml file. Any help would be appreciated.


1 Reply

DD Dharanidharan Dharmasivam Syncfusion Team March 1, 2019 10:14 AM UTC

Hi Rikard, 
Greetings from Syncfusion.  
We have analyzed your requirement. We have prepared a sample based on your requirement for rendering chart. Find the code snippet below. 
<button id="add" onclick="addChart()">Add Chart</button> 
function addChart() { 
        //Create div element dynamically and append to DOM 
        var chartEle = document.createElement('div'); 
        chartEle.id = 'chartContainer' + window.count; 
        //Configured chart here 
        var chart = new ej.charts.Chart({ 
            //Specify the required paramaters 
        //Append chart to dynamically created div element 
        chart.appendTo('#' + chartEle.id); 

Live Chat Icon For mobile
Up arrow icon