简体   繁体   English

Dc.Js行图删除空箱

[英]Dc.Js Row Chart removing empty bins

I have two row charts with crossfilter and Dc.Js. 我有两个带有crossfilter和Dc.Js的行图。

You can see my example here: http://blockbuilder.org/renauld94/363734495adb480201ee4ca3b676c5db 您可以在这里看到我的示例: http : //blockbuilder.org/renauld94/363734495adb480201ee4ca3b676c5db

I want to remove the empty bins follwing this https://github.com/dc-js/dc.js/wiki/FAQ#remove-empty-bins . 我想删除https://github.com/dc-js/dc.js/wiki/FAQ#remove-empty-bins之后的空垃圾箱。 I want to remove the empty bins of my district name chart. 我想删除我的地区名称图表中的空箱子。 How I can adapt my code? 如何修改我的代码? This is my fork with my attemp to remove the empty bins of my district Chart... Thanks for the help! 这是我的叉子,我想删除我地区图表中的空箱子...感谢您的帮助!

http://blockbuilder.org/renauld94/a3aabaa6f846cdcd5760c3c7885e27c0 http://blockbuilder.org/renauld94/a3aabaa6f846cdcd5760c3c7885e27c0

The problem is this line: 问题是这一行:

var group = allDim.group(districtgroup);

You are passing a group as your group key function when you construct another group, but a function is expected. 当您构造另一个组时,您正在传递一个组作为您的组键功能,但是需要一个功能。 That's why crossfilter keeps complaining that key (the group argument) is not a function. 这就是为什么crossfilter一直抱怨key (group参数)不是函数。

You already have a group which I think you intended to use: 您已经有一个小组,我认为您打算使用:

var districtgroup = districtDIM.group();

If you simply pass that through remove_empty_bins everything seems to work? 如果您只是通过remove_empty_bins传递所有内容,似乎一切正常?

var filtered_group = remove_empty_bins(districtgroup)

Fork of your fiddle. 你的小提琴的叉子。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM