I am trying to use D3 parcoords to create a parallel coordinates plot using CSV data but all the example that seem to work online don't work in local in my laptop (tried both with Chrome and Safari).
This how the script that is loading the CSV data looks like:
d3.csv('datatest.csv', function(data) {
pcz = d3.parcoords()("#example-zscore")
.data(data)
//.hideAxis(["name"])
.composite("darker")
.render()
.alpha(0.35)
.brushMode("1D-axes") // enable brushing
.interactive() // command line mode
change_color("weight (lb)");
// click label to activate coloring
pcz.svg.selectAll(".dimension")
.on("click", change_color)
.selectAll(".label")
.style("font-size", "14px");
});
Note that if I change .data(data)
to .data([ [0,-0,0,0,0,1], [1,-1,1,2,1,1], [2,-2,4,4,0.5,1], [3,-3,9,6,0.33,1], [4,-4,16,8,0.25,1] ])
a graphic with this data is plot.
My csv looks like:
name,economy (mpg),cylinders,displacement (cc),power (hp),weight (lb),0-60 mph (s),year
AMC Ambassador Brougham,13,8,360,175,3821,11,73
AMC Ambassador DPL,15,8,390,190,3850,8.5,70
AMC Ambassador SST,17,8,304,150,3672,11.5,72
AMC Concord DL 6,20.2,6,232,90,3265,18.2,79
AMC Concord DL,18.1,6,258,120,3410,15.1,78
Aucun commentaire:
Enregistrer un commentaire