upload

Usage: Uploads data for chart from csv, tsv or JSON file. The function will asynchronously fetch the data and return a promise if data is successfully fetched. This must be called before make, using, and in when creating a chart because you want the data to be fetched before building the chart.

If using this function, you would need to chain a then and use the data returned to create your chart. For catching any errors, we recommend chaining a catch at the end. See example below.

upload(dataFile)
Params Type Units
dataFile Object or String N/A

Example:

tld3.upload('./data/barData.csv') // uploads data from csv and returns a promise
    .then((data) => { // if the promise returns successfully, create the chart
      tld3.make('BarChart')
          .using(data)
          .in('#barchart');
    })
    .catch((err) => { // else handle error
      console.error(err);
    });