1
votes

I have a simple data set something like this one.

data = [ {column:'a',value:10}, 
        {column:'a',value:2}, 
        {column:'a',value:5}, 
        {column:'b',value:12}, 
        {column:'b',value:1},
        {column:'b',value:8},
        {column:'c',value:6}]

I have created a group on top of this data and used in data table which shows something like this (* considering all the dimension and groups are created at this stage)

Column Value
A      17
B      21
C      6

The real problem comes when I try to filter the data, I have attached a text filter to this. Whenever I try to filter it the records which have value == 0 doesn't not disappear rather it stays showing the value as 0 something like this

Case 1 : The textfilter is filtered with column 'a' the table is showing like this.

Column Value
A      17
B      0
C      0

How do I make the ones with zero value disappear from the table on filter while using groups in the data table ?

1
Crossfilter doesn't remove zeros automatically. This is the number one most asked question. See for example stackoverflow.com/a/27332165/676195 (not accepted, so I can't mark this as a dupe) - Gordon
I am trying the same for the grouped once on the tables which are aggregated. Removing empty or zero's is failing and throwing Uncaught TypeError: this.dimension(...).top is not. I am updating my question with example scenario. - Shahabaz
Thanks, here are some FAQ Links: fake groups. But I need .top()? - Gordon

1 Answers

1
votes

I am assuming you are looking for something like the chart build in following link:

dc charts with filtering removing

You can see the source code, they have written a method called "remove_empty_bins". You can also implement something like that.

I hope this answer your question. If you need more help, please create a demo for your problem.