.csv ファイルのデータからストリーム グラフを作成したいと考えています。ストリーム グラフを生成するためにhttp://bl.ocks.org/lgrammel/1935509をフォークしましたが、データの読み込みでスタックしました。私のJSは以下です。
var n = 8, // number of layers
m = 54; // number of samples per layer
var colors = d3.range(n).map(function() { return d3.interpolateRgb("#aad", "#556")(Math.random()); });
var streamgraph = streamgraphChart()
.margin({top: 10, right: 10, bottom: 10, left: 10})
.color(function(d, i) { return colors[i]; }) // use same colors for both data sets
.transitionDuration(1500);
d3.text("weekly_hours.csv", function(text) {
var data = d3.csv.parseRows(text).map(function(row) {
return row.map(function(value) {
return +value;
});
});
console.log(data);
d3.select("#chart")
.datum(data)
.call(streamgraph);
});
コンソール ログにはデータ配列が適切に表示されますが、エラーも発生しますError: Problem parsing d="MNaN,NaNLNaN,NaNLNaN,NaNLNaN,NaNLNaN,N
。http://bl.ocks.org/korenmiklos/8052011には何も表示されません