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);
});
})