Created
March 31, 2014 20:09
-
-
Save gavi/9901086 to your computer and use it in GitHub Desktop.
Get Column names from csv data using D3
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
As you read the data, use Object.keys() method to extract the column names. Might be useful for binding dropdowns. | |
*/ | |
var columns=null; | |
d3.csv('nutdata.csv').row(function(row){ | |
if(columns==null){ | |
columns=Object.keys(row); | |
columns=columns.slice(2,48); //Optional - to remove columns you dont need | |
} | |
return {"name":row.Shrt_Desc}; // Do data manipulation here | |
}) | |
.get(function(error,data){ | |
console.log("Finished Getting Data"); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment