    if (file) readFile(file);
    });
    function readFile(file) {
      const reader = new FileReader();
      reader.onload = () => handleText(String(reader.result||''));
      reader.readAsText(file);
    }

    $('#hasHeader').addEventListener('change', (e) => {
      state.hasHeader = !!e.target.checked;
      handleText(state.rawText);
    });
    $('#delimiter').addEventListener('change', (e) => {
      state.delimiter = e.target.value;
      handleText(state.rawText);
    });

    $('#chartType').a