bhogan
June 27, 2018, 8:03pm
1
It looks like there is a pretty fixed list of available aggregation functions.
'A reference to the data array in the parent trace to aggregate.',
'To aggregate by nested variables, use *.* to access them.',
'For example, set `groups` to *marker.color* to aggregate',
'over the marker color array.',
'The referenced array must already exist, unless `func` is *count*,',
'and each array may only be referenced once.'
].join(' ')
},
func: {
valType: 'enumerated',
values: ['count', 'sum', 'avg', 'median', 'mode', 'rms', 'stddev', 'min', 'max', 'first', 'last'],
dflt: 'first',
role: 'info',
editType: 'calc',
description: [
'Sets the aggregation function.',
'All values from the linked `target`, corresponding to the same value',
'in the `groups` array, are collected and reduced by this function.',
'*count* is simply the number of values in the `groups` array, so does',
'not even require the linked array to exist. *first* (*last*) is just',
'the first (last) linked value.',
Is it possible to pass in a custom function for aggregation? If not, would you consider adding a couple of additional functions?
I believe that functions for range (i.e. max - min) and change (i.e. last - first) could be very useful for a variety of applications and would build off of functions that you already provide.
No. Plotly’s API is strictly JSON, no functions are accepted.
Yes.
bhogan
June 28, 2018, 2:15pm
3
Great, thank you! I will try to put together a PR for additional functions.
bhogan
June 28, 2018, 2:54pm
4
Here’s a github issue for further coordination: https://github.com/plotly/plotly.js/issues/2763
Thanks in advance for your consideration.