Hi Utsav,
That's some good digging - indeed, fadeDeselectedArea is the function
dc.js uses to fade the deselected bars, but unfortunately it's an
internal function - not an option like you might expect, but a method
that actually applies the styles when the chart is drawing itself.
It would be great if the style of brushing were an option so that you
could enable ordinal-style click filtering when the scale is
quantitative, and brushing when the scale is ordinal.
It doesn't look like you can use to deselect bars when you are
performing the selection yourself, because it relies on the brush to
figure out which bars are selected, and you've disabled the brush.
There is also a problem with how you are performing the filtering -
when the bar chart has a quantititative scale, it's expecting the
filter to be a ranged filter. chart.filter also *toggles* filters
instead of replacing them, so you should set the filter like this:
chart.replaceFilter(dc.filters.RangedFilter(d.data.key,
d.data.key+1))
Note that you'll have to change "1" to whatever the width of your bars
really is.
Then, since you can't use the built-in fade, you could apply your own
fade like this:
chart.selectAll('rect.bar').classed('my-fade',
function(d1) { return d1.data.key !== d.data.key});
and set your own css for .my-fade, e.g.
rect.my-fade {
fill: #ddd;
}
Here's a fork of your fiddle:
https://jsfiddle.net/gordonwoodhull/4zy79ofo/11/
Cheers,
Gordon
> --
> You received this message because you are subscribed to the Google
> Groups "dc-js user group" group.
> To unsubscribe from this group and stop receiving emails from it,
> send an email to
dc-js-user-gro...@googlegroups.com.
> To view this discussion on the web visit
>
https://groups.google.com/d/msgid/dc-js-user-group/5a5aba84-5480-41bf-a59c-2ccd0be55e83%40googlegroups.com.