Asad Khan
Asad Khan

Reputation: 357

How can i remove empty bars from dc.js row chart, whenever the dimension is null or empty, there appears an empty bar on row chart

How can i remove empty bars from dc.js row chart, whenever the dimension is null or empty, there appears an empty bar on row chart.

Empty Bar in row chart

Upvotes: 2

Views: 375

Answers (1)

sf_
sf_

Reputation: 1206

You have to use fake group

const remove_empty_bins = (source_group) => {
    return {
        all: () => {
            return source_group.all().filter(function(d) {
                // here your condition
                return d.key !== null && d.key !== '' && d.value !== 0; // etc. 
            });
        }
    };
}

let myFilteredGroup = remove_empty_bins(myGroup);

Upvotes: 1

Related Questions