문제

I'd like to know if dc.js can render a bar chart without dimension, for example, a bar chart displaying the reduce result of ALL data.

enter image description here

When we want to render a bar chart we always do like this:

chart.width(400)
.height(200)
.dimension(...some Dimension here...)
.group(...some Group here...)
.valueAccessor(function (p) {
    return p.value.someValue;
})
.x(d3.time.scale().domain(["Global"]))
.y(d3.scale.linear().domain([0, 100]))
.yAxis().tickFormat(function (v) {
    return v + "%";
}); 
chart.render();

My question is what to put in the dimension and group in order to achieve my purpose? The documentation says that dimension() is mandatory.

Thanks very much!

도움이 되었습니까?

해결책

The easiest way to do this is probably to add an additional attribute to your data that has the same value for everything and use that as the dimension.

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top