how to display bottom data for row chart using dc.js

心已入冬 提交于 2019-12-10 10:03:57

问题


I'm making a rowchart using the Dimensional Charting javascript library dc.js, which is based on d3 and crossfilter. i am display the rowchart for top(10) data.but i am trying to display rowchart for bottom(10) data but graph can be display same as the top(10) data.how to display bottom(10) data.

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

回答1:


If you don't want to create another dimension/group as @LarsKotthoff suggests, you can also use .top(Infinity) and then .splice(-10) the last ten entries off the array.

There are efficiency tradeoffs between having extra dimensions versus sorting all the data, so you might try both to see which performs better.



来源:https://stackoverflow.com/questions/23215610/how-to-display-bottom-data-for-row-chart-using-dc-js

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!