Simon GIS
Simon GIS

Reputation: 1055

Dc.Js Row Chart removing empty bins

I have two row charts with crossfilter and Dc.Js.

You can see my example here: 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. 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

Upvotes: 0

Views: 130

Answers (1)

Gordon
Gordon

Reputation: 20150

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.

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?

var filtered_group = remove_empty_bins(districtgroup)

Fork of your fiddle.

Upvotes: 1

Related Questions