Check Out the Chart.js Course: Chart.js, The Missing Manual Course
Categories
Uncategorized

How to connect a CSV File with Fetch in Chart.js

In Chart.js we can connect with a CSV file. Using a CSV file which is basically a table file with data commonly exported from an Excel file. Being able to read these kind of files with Chart js gives you the ability to make systems and dashboards from Excel data.

Connect a CSV File with Fetch in Chart.js

Chart.js is a Javascript library and this means it needs to read all data in a so called format. That means we need to parse the CSV data to make it readable for JavaScript. This video shows you exactly how.

How to connect a CSV File with Fetch in Chart.js

What is Parsing in Javascript?

Perhaps you might wonder what this does. To understand parsing we need to know what the word ‘to parse’ means. To parse means to make something readable for. In this case it is for JavaScript.

In computer language CSV files is considered a different language that cannot be understood by JavaScript. So parsing is basically translating the CSV data into a JavaScript readable version. Once we did that we can start to use that data.

What is Fetching?

Fetching in JavaScript can be seen as throwing a bone and ordering a pet dog to get the bone. In this case the bone is the metaphor for the data. So we are getting data and ordering to get specific data back that we want. Fetching always works based another file that contains data. In video we are using a CSV file.

However it is not restricted to a CSV file. It could be any acceptable file that we can parse into readable Javascript data.

Leave a Reply

en_USEnglish