Hi Umer,
Thanks for using syncfusion products,
We have analyzed your query. As for your requirement we have prepared a sample for delete previous series while select to add new series. Kindly find the code snippet below to achieve this requirement.
|
HTML
<ejs-chart #chart id='chartcontainer' >
<e-series-collection>
<e-series [dataSource]='data' type='Column' xName='x' yName='y' > </e-series>
</e-series-collection>
</ejs-chart>
<button ejs-button class='e-flat' (click)='add1()'>add series1 </button>
<button ejs-button class='e-flat' (click)='add2()'>add series2</button>
TS
add1() {
this.chart.series = [];
this.chart.addSeries([{
type: 'Column', fill: ‘red’,
dataSource:data1, xName: ‘x’,
yName: 'y', marker: this.marker
}]);
}
add2() {
this.chart.series = [];
this.chart.addSeries([{
type: 'Column', fill: ‘blue’,
dataSource: data2,
xName: 'x', width: 2,
yName: 'y', marker: this.marker
}]);
} |
Screenshot:
Sample for your reference can be find from below link,
Kindly revert us, if you any concerns.
Thanks,
Baby.