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. (Last updated on: November 16, 2018).
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

Create chart dynamically

Thread ID:

Created:

Updated:

Platform:

Replies:

143010 Feb 28,2019 12:52 PM UTC Mar 1,2019 10:14 AM UTC ASP.NET Core - EJ 2 1
loading
Tags: Charts
Rikard Schouwstra
Asked On February 28, 2019 12:52 PM UTC

Hi

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.

Regards

Dharanidharan Dharmasivam [Syncfusion]
Replied On 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. 
 
[ChartFeatures.cshtml] 
 
<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; 
        document.getElementsByTagName('body')[0].appendChild(chartEle);  
 
        //Configured chart here 
        var chart = new ej.charts.Chart({ 
            //Specify the required paramaters 
        }); 
        //Append chart to dynamically created div element 
        chart.appendTo('#' + chartEle.id); 
} 
 
 
 
Thanks, 
Dharani.  


CONFIRMATION

This post will be permanently deleted. Are you sure you want to continue?

Sorry, An error occured while processing your request. Please try again later.

Please sign in to access our forum

This page will automatically be redirected to the sign-in page in 10 seconds.

Warning Icon You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.Close Icon

;