Adding a new line to LineChart

Sir ,
As the sample below, how can I modify to adding a new line and new legend:{text:“company C”, color:“#ee4339”} after a button click?

dhtmlx.com/docs/products/dhtmlxC … eries.html

Thank you
Best regards

Hello,

you need to destruct a chart and then create it with the new settings:

if(chart)
chart.destructor()
chart = new dhtmlXChart({…});