【发布时间】:2015-08-26 10:06:42
【问题描述】:
我正在尝试使用 Crossfilter.js D3.js 和 DC.js 返回 Top 10 列表并显示在行图中。
HTML文件指向代码所在的js文件,如下:
var Chart8 = dc.rowChart("#rChart8", "group1");
var People = ndx.dimension(function (d) {return d.datPeople;});
var People_Grp = People.group().reduceSum(function (d) { return d.datVal; });
Chart8.width(300)
.height(530)
.margins({top: 20, left: 10, right: 10, bottom: 20})
.transitionDuration(750)
.dimension(People)
.group(People_Grp)
.colors(ColourSet1)
.renderLabel(true)
.gap(1)
.title(function (d) { return ""; })
.elasticX(true)
.xAxis().ticks(8).tickFormat(d3.format("s"));
任何人都可以帮助过滤这个以仅显示前 10 个值 (datVal) 吗? 我尝试过使用“.top(10)”,但显然缺少一些东西。
非常感谢
【问题讨论】:
标签: javascript jquery d3.js dc.js