Creating a Chart with unknown number of bars

Hi,


I would like to create a chart without having to hard code how many bars are in the chart. The chart will have a number of company names on the x-axis and then an int value on the y-axis but the number of companies will be determined by the number of companies stored in our data base at anyone time. I was wondering is it possible to do this?


Kind Regards,


RJ


1 Reply 1 reply marked as answer

DG Durga Gopalakrishnan Syncfusion Team March 10, 2022 05:38 PM UTC

Hi RJ, 

Greetings from Syncfusion. 

We request you to use chart refresh method to update the series datasource. We have prepared sample based on your requirement. Please check with the below snippet and screenshots. 

<script> 
document.getElementById('button').onclick = () => { 
        var chart = document.getElementById('container').ej2_instances[0]; 
        chart.series[0].dataSource = newData; 
        chart.refresh(); 
    }; 
</script> 

Before Update 
 

After Update 
 


Kindly revert us if you have any concerns. 

Regards, 
Durga G. 


Marked as answer
Loader.
Up arrow icon