crossfilter / reductio

Reductio: Crossfilter grouping
Other
248 stars 42 forks source link

Ratio/Rate Reduction #34

Closed fernandrez closed 8 years ago

fernandrez commented 8 years ago

Hi is there way to perform a reduction of the type sum(field1) / sum(field2). Thanks in advance.

fernandrez commented 8 years ago

Taking a look at the value, so I can keep two sums and then use the ratio in the valueAccessor function, will try this now.

esjewett commented 8 years ago

Yup, that's right. Use 2 values for the 2 sum reductions. I'd actually stay away from the valueAccessor function (it was probably a bad idea) and just implement this logic in your visualization or whatever you are using the groups for.

fernandrez commented 8 years ago

Yes true, was referring to the visualization in DC.js, using BarChart's value accessor to access the reducing objects to perform this rate. Could not do this yesterday but will implement it today and hopefully close the ticket. Thank you @esjewett for your answer.

esjewett commented 8 years ago

Ah, great. Yes, that's exactly the thing to do, I'd think. Thanks for asking and for using reductio!

fernandrez commented 8 years ago

Worked like a charm, thank you for the availability.