I'm going through Mike Bostock's code for the marimekko graph, shown here: https://bl.ocks.org/mbostock/1005090
I have a couple of questions about code segments that I don't understand:
var sum = segments.reduce(function(v, p) {
return (p.offset = v) + (p.sum = p.values.reduceRight(function(v, d) {
d.parent = p;
return (d.offset = v) + d.value;
}, 0));
}, 0);
This one, I gather is related to calculating the translation of the bars, but I really don't understand what it is calculating or doing. What are v and p? I know what d and i are as function arguments, but haven't seen v and p.
How would I go about changing the x-axis tick labels to not be percentages but rather to be the absolute value of the sum of the segment?
I think I need to update the x function to change the domain of the value to be equal to the sum of the markets within the segment but each market is different so I can just do a max on the data like I've seen in examples.