Okay, so what I meant is that you have a choice what you want the group reduction to return - it looks like you're just reducing numbers for the Y value, but you could also include other information in there to control aesthetics or titles for the dots.
Simple example: aggregate two columns instead of one.
Say your group reduction is currently summing column q:
group.reduceSum(function(d) { return d.q; })
If you wanted to also sum another column r, you could use a custom reduction like this:
group.reduce(
function(p, v) { // add
p.q += v.q;
p.r += v.r;
return p;
},
function(p, v) { // remove
p.q -= v.q;
p.r -= v.r;
return p;
},
function() { // init
return {q: 0, r: 0};
}
})
Now instead of returning {key: number, value: number} objects, the group will return objects
{key: number, value: {q: number, r: number}}
You'll need to specify the chart's valueAccessor because value is not just a number anymore:
chart.valueAccessor(function(kv) { return kv.value.q; })
And if you want to e.g. use r for the color:
chart.colorAccessor(function(kv) { return kv.value.r; })