How can I select csv files through dropdown menu in d3.js

Viewed 18

Actually I am trying to select csv file for my chart from dropdownmenu using d3.js but it is not selecting the options

window.filename = "{path}"; //file path thatI want to change through dropdown
const data1 = []; 
const data2 = [];
const labels = [];

The function for selecting new csv file

function goToNewPage() {
  var url = document.getElementById('csv').value;
  if (url != 'none') {

    window.location = url;
    window.filename = url;
    console.log(url)
  }
}

Please help me select different file path for the chart through the dropdown below

<form>
  <select name="csv" id="csv">
    <!-- <onmousedown="this.value='';" onchange="csv(this.value)"> -->
    <option value="{% static 'js/ff.csv' %}">1.CSV</option>
    <option value="https://stackoverflow.com/questions/67995141/chart-update-is-not-a-function-typeerror">2.CSV</option>
    <option value="{% static 'js/sketch.js' %}">3.CSV</option>
    <option value="{% static 'js/f.csv' %}">4.CSV</option>
  </select>
  <input type=button value="Go" onclick="goToNewPage()" />
</form>
0 Answers
Related