Ryan
Ryan

Reputation: 427

Hide Specified Row in dc.js rowchart

Does anyone know a good hack to hide a row from a row chart in crossfilter/dc.js, that is do not chart a particular key.

I want to show some relevantly small %s and hide the 99% which fits in the other category (and prevent a user from filtering on the row).

This doesn't work...as it filters the data

function remove_bins(source_group) {
return {
    all:function () {
        return source_group.all().filter(function(d) {
            return d.key = 1;
        });
    }
} };

var filtered_group = remove_bins(myGroup);

Where I just need to prevent the chart from displaying the huge row. Preferably done within the chart, I expect.

Any ideas welcome!

Ryan.

Upvotes: 1

Views: 500

Answers (2)

stallingOne
stallingOne

Reputation: 4006

Maybe filtering the dimension of the row chart with a condition?

.dimension(function(d) {  if (d.xxx != "N/A") { return d.Genre ; }})

Upvotes: -1

Gordon
Gordon

Reputation: 20120

As answered on the user group.

Take a look at the FAQ: there is a section about pre-filtering the data. You ought to be able to adapt one of these examples pretty easily.

https://github.com/dc-js/dc.js/wiki/FAQ#filter-the-data-before-its-charted

Will add detail here if needed.

Upvotes: 0

Related Questions