NumberDisplay not affected by rangeChart?

24 views
Skip to first unread message

ben palmer

unread,
Mar 1, 2021, 2:52:33 AM3/1/21
to dc-js user group
Hi 
I have pretty much used the  dayOfWeekChart, volumeChart (Range Chart) and move chart from the getting started demo, with my data, so far so good.

I have added a NumberDisplay, to show the sum of one variable of the of the selected data.

This NumberDisplay updates perfectly in response to the dayOfWeekChart interaction, but ignores changes to the date range being set by the range chart.

Is there a way to pass the date range beings set so that the reduceSum behind the NumberDisplay is limited to the date range of interest ?

Thank you
Ben


NumberDisplay code

const totalAmount    = new dc.NumberDisplay("#number-box");

var sumAllAmount = dateDimension.groupAll().reduceSum(function(d) { return  d.amount });

 totalAmount.group(sumAllAmount)
      .formatNumber(d3.format(".2s"))
      .valueAccessor(function(d) { return d; })

Gordon Woodhull

unread,
Mar 1, 2021, 9:02:46 AM3/1/21
to dc.js user group
Hi Ben,

Sounds like you are using dateDimension for both the number display and the range chart.

You probably need to create another date dimension, since a group does not observe its own dimension's filters.

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/049e2afd-db44-4d3b-a0a0-d2351fbd1d7fn%40googlegroups.com.

Gordon Woodhull

unread,
Mar 1, 2021, 9:05:33 AM3/1/21
to dc.js user group
Or better, you can use crossfilter.groupAll(), which is not associated with a dimension and observes all filters.


ben palmer

unread,
Mar 2, 2021, 6:58:49 PM3/2/21
to dc-js user group
Thank you very much, you anticipated my next question, what if I am running out of dimensions :-)
Reply all
Reply to author
Forward
0 new messages