d3 및 crossfilter를 기반으로하는 Dimensional Charting 자바 스크립트 라이브러리 dc.js를 사용하여 행 차트를 만들고 있습니다. 나는 top (10) 데이터에 대한 rowchart를 표시하고 있지만 bottom (10) 데이터에 대한 rowchart를 표시하려고하지만 그래프는 top (10) 데이터와 동일하게 표시 될 수 있습니다. bottom (10) 데이터를 표시하는 방법.
constRowChart.width(350)
.height(1000)
.margins({top: 20, left: 120, right: 10, bottom: 20})
.transitionDuration(750)
.dimension(density)
.group(const_total)
.renderLabel(true)
.gap(1)
.title(function (d) {
return "";
})
.elasticX(true)
.colors(d3.scale.category20c())
.ordering(function(d) { return d.value })
.xAxis().ticks(3).tickFormat(d3.format("s"));
constRowChart.data(function (group) {
return group.top(10);
});
@LarsKotthoff가 제안한대로 다른 차원 / 그룹을 생성하지 않으려면 배열에서 마지막 10 개 항목 .top(Infinity)
을 사용할 수도 있습니다 .splice(-10)
.
추가 차원을 갖는 것과 모든 데이터를 정렬하는 것 사이에는 효율성 절충점이 있으므로 어느 것이 더 나은지 확인하기 위해 둘 다 시도 할 수 있습니다.
이 기사는 인터넷에서 수집됩니다. 재 인쇄 할 때 출처를 알려주십시오.
침해가 발생한 경우 연락 주시기 바랍니다[email protected] 삭제
몇 마디 만하겠습니다