I am trying to read in some csv data, select a specific column(SST), and create an array where each item is: { x: row#, y: SST_for_that_row }.
<script src="http://d3js.org/d3.v3.min.js"></script>
<script>
var dat=[];
d3.csv("stratus2.txt", function(t) {
dat = t;
});
f=dat.map(function(d,i) {
return {x:i,y:d.SST}
</script>
My firefox console shows me that the "dat" variable is successfully loaded, but "f" is empty. However, if I directly type the following into the console, it loads just fine.
f=dat.map(function(d,i) {
return {x:i,y:d.SST}
Is there perhaps some sort of scoping issue? Thanks in advance, Ben