nt.createElement('a');
      link.download = `chart-${Date.now()}.png`;
      link.href = chart.toBase64Image('image/png', 1);
      document.body.appendChild(link); link.click(); link.remove();
    });
    $('#btnReset').addEventListener('click', () => {
      Object.assign(state, {
        rawText: '', rows: [], headers: [], hasHeader: true, delimiter: 'auto',
        labelColumn: 0, chartType: 'line', datasets: [], valueColumn: 1,
        datasetColors: {}, palette: 'vibrant', baseColor: '#6b76ff', canva