Hi, Is there a clean approach to allowing DataTable aggregation functions to accept multiple columns? For example, if a column's aggregation function is a weighted average of its values weighted by another column's values, I'd want to pass both columns to my aggregation function. Is there an easy way to do this? Weighted averages are extremely common to compute in many real life applications, but I didn't see a straightforward way of doing this with the current DataTable implementation. (Making a calculated column and then averaging that might work for this example, but creating new views with calculated columns just to compute an aggregation for another already existing column is a lot of extra work, and can become cumbersome and errorprone for more complex calculations).
I've been working around this limitation by using currying and closures to define aggregation functions that use two or more columns, but present an interface to the DataTable that uses one column. I had to extend the Function class to permit currying, which doesn't feel good. Perhaps there's an easier method in js, but this is the only way that came to mind. So my questions: - is there a clean Javascript method of effectively implementing an aggregation function that accepts multiple rows? - is there any reason that the aggregation methods don't look at the column value and, if it's a scalar, do the current implementation, but if it's an array, pass all of those columns to the aggregation function? Sort of the same question ;) I'll put in an enhancement request if there are no good suggestions, but I want to hear from more experienced js coders if there's a more elegant solution that I'm missing. thanks, -- You received this message because you are subscribed to the Google Groups "Google Visualization API" group. To post to this group, send email to [email protected]. To unsubscribe from this group, send email to [email protected]. For more options, visit this group at http://groups.google.com/group/google-visualization-api?hl=en.
