我是d3js的新手并且正在检查以前的解决方案,并且一直在尝试这些解决方案而没有成功解决我的问题。 我的线图has the out put as this enclosed picture 在2维上应用d3.nest()之后我的数据结构是{“10”:86,“14”,114}。我正在绘制x轴上的键(“10”)和Y轴上的值86。我的量表定义如下:
var x =d3.scale.ordinal()
.rangeBands([0, width])
.domain(["01","02","03","04","05","06","07","08","09","10","11","12"
,
"13","14","15","16","17","18","19","20","21","22","23","24"]);
var y = d3.scale.linear()
.range([height,0])
.domain([0, d3.max(grpdata, function(d) {
return d.values;
})]);
我也尝试将密钥转换为字符串。
var valueline = d3.svg.line()
.x(function(d) {
return (d.key).toString() ;
})
.y(function(d) {
return y(d.values);
});
有没有办法正确显示图表,使其延伸到x刻度的末尾。非常感谢任何帮助,谢谢