In cases where an accessor is invoked only once, I think it still needs to propagate the this context and additional arguments. This is to maximize compatibility with selection methods (such as selection.attr), in case you want to customize the behavior of the generator using, say, parent data or indices. For example, in the arc shape, when we compute the innerRadius and outerRadius, we shouldn’t assume that the only arguments are d and i.
In contrast, if the accessor is evaluated multiple times, then we should apply the convention from d3-arrays and array.forEach, namely d, i and array. So that should be used for line.x, line.y, line.defined, etc.
In cases where an accessor is invoked only once, I think it still needs to propagate the
this
context and additional arguments. This is to maximize compatibility with selection methods (such as selection.attr), in case you want to customize the behavior of the generator using, say, parent data or indices. For example, in the arc shape, when we compute the innerRadius and outerRadius, we shouldn’t assume that the only arguments are d and i.In contrast, if the accessor is evaluated multiple times, then we should apply the convention from d3-arrays and array.forEach, namely d, i and array. So that should be used for line.x, line.y, line.defined, etc.