score:3

Accepted answer

use this function to locate the dots in the column names and keep only the last part of any name that has a dot:

function removedot(d){
    object.keys(d).foreach(function(origprop) {
        var nodot = origprop.split(".")[1];
        if (nodot != undefined) {
          d[nodot] = d[origprop];
          delete d[origprop];
        }
     });
     return d;
};

to use this function, define an accessor like this:

d3.tsv(file, removedot, function(error, data) {
    //all your code here
});

note: keep in mind that only d3.csv and d3.tsv accept accessors.


Related Query

More Query from same tag