Reputation: 9441
EDIT: I've read more about using Rails & D3 and the advice I've heard is use JSON for incoming data and make your life easier. Lesson learned.
Basic Ruby/Rails app, creating a stock chart with d3. However, I cannot seem to load my dataset (in this case .csv file saved inside the rails app. Console shows this error:
"GET http:// localhost:3000/pages/sp500.csv 404 (Not Found)" (space added)
My code:
d3.csv("sp500.csv", function (data) {
data.forEach(function(d) {
d.date = parseDate(d.date);
d.price = +d.price;
});
Tried saving the sp500.csv in various directories and calling it in variety of ways, but still stuck. Thanks for help.
Upvotes: 1
Views: 1799
Reputation: 3747
You are getting this error because your Rails application isn't serving up the file because it doesn't know to do so. I had the same issue recently when designing an app with Node.js. It has been too long since I have used Rails, so I am afraid that I am not able to help out further than that.
Upvotes: 1
Reputation: 11258
Can you access the file via browser directly without your app and d3?
Upvotes: 1