Shauny
Shauny

Reputation: 61

How to read a csv file in jsfiddle

I am trying to read an external csv in JSFiddle using d3.js

I have followed the instructions suggested HERE, but still no success.

THIS is my JSfiddle

   d3.csv.parse( d3.select("pre#ddata").text(), function (data) {...

Can someone please suggest what I a doing wrong here

Upvotes: 0

Views: 1574

Answers (1)

topheman
topheman

Reputation: 7902

Your jsFiddle is missing some closing curly brackets somewhere (check the console) and you're using d3.csv.parse the wrong way : you should have something like :

data = d3.csv.parse(d3.select("pre#ddata").text(),function(data){
    return {
        date : data.date,
        premise : data.premise,
        apc : data.apc
    }
});

https://github.com/mbostock/d3/wiki/CSV#parse

Upvotes: 1

Related Questions