Dygraphs autoupdate from a CSV file

I couldn’t get autoupdating to work with dygraph with the examples they gave due to it being for randomly generated data here is how you get it to update with a CSV.

This is the code I ended up with it seems to work without error.

Make sure that you don’t have any labels at the top of your CSV file and instead use: “labels: [‘Time’, ‘Status’],” putting in your labels as needed.

Making your file look like so

Other examples will use:
“graph1.updateOptions(¬†{‘file’: plotData¬†});”

But I found this didn’t work throwing up an error saying “plotdata is undefined”¬† the same goes for

“graph1.updateOptions( { ‘file’: csv_data } );”

I found that using:

“graph1.updateOptions( { ‘file’: “/solarvoltage/voltage.txt” } );”

and actually defining the file is what got it to work in the end.