"http://dc-js.github.io/dc.js/examples/stacked-bar.html"이 종류의 데이터 집합을 단일 막대 스택 막대 차트로 옮기고 싶습니다. 나는 speedSumGroup2 = runDimension.groupAll().reduce(function(p, v) {
DC 스택 형 막대 예제를 단일 막대에 롤업하는 방법은 무엇입니까?
에
speedSumGroup = runDimension.group().reduce(function(p, v) {
p[v.Expt] = (p[v.Expt] || 0) + v.Speed;
return p;
}, function(p, v) {
p[v.Expt] = (p[v.Expt] || 0) - v.Speed;
return p;
}, function() {
return {};
});
을 변경하고 그룹을 검사하면 데이터가 예상 한 최대 압연 보여줍니다. 원래는 모든(),이 그룹은 a.group.all는 "주는 차트
chart
.width(768)
.height(480)
.x(d3.scale.linear().domain([1,21]))
.margins({left: 50, top: 20, right: 10, bottom: 20})
.brushOn(false)
.clipPadding(10)
.title(function(d) {
return d.key + '[' + this.layer + ']: ' + d.value[this.layer];
})
.yAxisLabel("This is the Y Axis!")
.dimension(runDimension)
.group(speedSumGroup2, "1", sel_stack('1'))
.renderLabel(true);
작동하지 않습니다 필요로하는 반면
Object {1: 18180, 2: 17120, 3: 16900, 4: 16410, 5: 16630}
그러나 나는 .value()로 데이터를 검사 함수가 아닙니다 "오류가 발생합니다. dimension.groupAll()의 결과가 차트에 플러그인 할 수있는 표준 그룹입니까?