1
我想用d3js繪製一個line-chart
。但似乎沒有工作,或者我沒有得到任何error
。d3js - 我的折線圖不起作用
如何克服這個問題。我無法發佈你的完整的代碼,請訪問我的龐然大物,看看真正的問題。
$(function() {
// the part not working for me
datas.forEach(function(d) {
d.date = parseDate(d.date);
d.close = d.close;
// Scale the range of the data
x.domain(d3.extent(d, function(d) {
return d.date;
}));
y.domain([0, d3.max(d, function(d) { return d.close; })]);
// Add the valueline path.
svg.append("path")
.attr("class", "line")
.attr("d", valueline(d));
// Add the X Axis
svg.append("g")
.attr("class", "x axis")
.attr("transform", "translate(0," + height + ")")
.call(xAxis);
// Add the Y Axis
svg.append("g")
.attr("class", "y axis")
.call(yAxis);
});
})