Reputation: 743
I am trying to create a chart from historical stock information, retrieved from Yahoo Finance, using Dygraphs.
The url I am trying to use as source of data is: http://ichart.finance.yahoo.com/table.csv?s=UL.PA&a=08&b=7&c=1984&d=01&e=24&f=2014&g=d&ignore=.csv
When I include the code below in my HTML file, I do not get any error message with Firebug. Yet the chart is empty.
Could anyone help me explain what I am doing wrong?
<div id="graphdiv"></div>
<script type="text/javascript">
g = new Dygraph(document.getElementById("graphdiv"),"http://ichart.finance.yahoo.com/table.csv?s=UL.PA&a=08&b=7&c=1984&d=01&e=24&f=2014&g=d&ignore=.csv",{});
</script>
LC
Upvotes: 0
Views: 281
Reputation: 16955
You're running into the same-origin policy for XmlHttpRequest.
When I run your code in jsfiddle, I see this error in the Chrome Developer Console:
XMLHttpRequest cannot load http://ichart.finance.yahoo.com/table.csv?s=UL.PA&a=08&b=7&c=1984&d=01&e=24&f=2014&g=d&ignore=.csv.
No 'Access-Control-Allow-Origin' header is present on the requested resource.
Origin 'http://fiddle.jshell.net' is therefore not allowed access.
You'll have to do the request server-side, rather than client-side.
Upvotes: 1