implement data threshold grouping
davelandry opened this issue · 3 comments
davelandry commented
d3plus 1.0 has a feature that groups data under a certain percentage ("threshold") into an "Values < X%"
category. This should be implemented in the new d3plus:
- a
threshold
method that accepts a Number or an accessor Function - a
thresholdKey
method that tells d3plus-viz what value to use (accepts a String or a Function). It will then be on each visualization (ie. Treemap) to set a default value for this method (ie. when a user definessum
, also definethresholdKey
if it has not been defined. - grouping logic should be implemented after this line
- if it is a Function, pass the function the
flatData
and expect a returned Number - add a
key
to thenest
that nests any data that has athresholdKey
less than that the overall total for that group and give it a differentkey
frabarz commented
I need a clarification on the way the new category would be made. The "Values < X%"
makes me think on a "all items whose d[value]
is lower than sum(d[value]) * threshold
" criteria, but Carlos made me think it would also useful to group "all items belonging to the lower threshold * 100
% of the data".
davelandry commented
from the Slack conversation: let's make it "all items whose value
is lower than the overallTotal * threshold
, where overallTotal
is calculated across the entire dataset (not for each group)
davelandry commented
implemented!