dataCount problematic behavior when replacing data

18 views
Skip to first unread message

Frozenlock

unread,
Jun 21, 2017, 4:28:59 PM6/21/17
to dc-js user group
I've followed the example here to replace data while keeping the filters intact.

It seems to work with every chart component except dc.dataCount.
When the data is replaced, the total count is correct, but the filter-count turns negative.

Is this a bug, or am I missing a step?

Gordon Woodhull

unread,
Jun 21, 2017, 5:27:26 PM6/21/17
to dc.js user group
Hi Frozenlock,

When you ask a question, could you please, please include a working example?

If you don't, you're pretty much forcing people to reproduce your work in order to answer your question.


I'm not seeing negative numbers; the count updates and the old filter is applied to the new data correctly.

dc.dataCount is a pretty obscure component, so I'm guessing you've attached it to something it's not compatible with. Although it can be convinced to display other things, it's only expecting to be attached to a crossfilter instance (for its "dimension" ugh) and groupAll.

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/f3b09d33-a0cf-4bec-97ab-2a7b403cd540%40googlegroups.com.

Gordon Woodhull

unread,
Jun 21, 2017, 5:44:02 PM6/21/17
to dc.js user group
(that or you're using a custom groupAll reduction and there is a mismatch between your reduceAdd and reduceRemove functions)

Frozenlock

unread,
Jun 21, 2017, 8:12:26 PM6/21/17
to dc-js user group
> When you ask a question, could you please, please include a working example?

Will do! Thanks you so much for taking the time to answer me.

After your response, I tried moving a few things around and use different dimensions and groupings.
(I was already using (.dimension ndx) and (.group all))

Nothing worked.

That is until I switched the order of re-applying the filters and adding the new data.
I did the same thing on your fiddle and it still works.

For some reason the order matters on my charts but not on the example provided.

----

Ok, I think I found the problem.
One of the charts has a on-filtered hook to focus some followers charts.
Turns out that everything is fine until I use the .focus method.

When I use .focus, I must make sure that filters are applied before adding the new data or the dataCount will be wrong.
Reply all
Reply to author
Forward
0 new messages