How to Graph data from csv file?

Hi, I’ve made myself an application with a node.js server serial-connected to Arduino. The Arduino is collecting temperature data and the server sends it to a P5.js web-page and logs it to csv file. I’d like to show a graph of the csv data. In the web-page how do I ask for the file of data and get it into a table or array so I can plot it?

1 Like

Check out loadTable(). The example shows you how to load in a .csv file. You might also have to use the fetch api if you’re csv file is on a server and not local.

Also Dan Shiffman recently made some videos about graphing using chart.js which might a quicker way to create some graphs if you don’t want to spend forever styling graphs in p5js. Here’s a link to that. Also the 1.2 video in that course is about parsing csv files that you get from the fetch api.

Hope that helps!

1 Like

@figraham, thanks, I have something simple working with loadTable (worked without ‘fetch api’, just coming from the server’s folder. I haven’t spent much time formatting and I have started watching the video.
Thanks again.

2 Likes