sdgaw erzswer
sdgaw erzswer

Reputation: 2382

Reading a .csv file for dygraphs javascript plotting library

I am completely new to web development and thus this may sound extremely dumb but still. My aim is to plot a csv file located either on my server, or in a specific URL. The javascript library I discovered that can do this is dygraphs. What I am trying to do is just re-create the example they give at their site:

<html>
<head>
<script type="text/javascript"
  src="dygraph-combined-dev.js"></script>
</head>
<body>
<div id="graphdiv2"
  style="width:500px; height:300px;"></div>
<script type="text/javascript">
  g2 = new Dygraph(
    document.getElementById("graphdiv2"),
    "temperatures.csv", // path to CSV file
    {}          // options
  );
</script>
</body>
</html>

I put this snippet in the same folder as my csv files, and it doesnt work(my csv is named temperatures.csv). Is there any way I can actually do this. Again, I just want to have a nice plot on my website, representing my csv on the server or URL (no idea how)

Thanks

Upvotes: 1

Views: 900

Answers (2)

partizanos
partizanos

Reputation: 1136

Change this line :

src="dygraph-combined-dev.js"></script>

to:

src="./dygraph-combined-dev.js"></script>

and make sure you have the file "dygraph-combined-dev.js" in the same folder as the html page you created.

Upvotes: 1

sdgaw erzswer
sdgaw erzswer

Reputation: 2382

I figured out Firefox works perfectly, chrome doesn't. Thanks for the URL par tho.

Upvotes: 1

Related Questions