Accepted answer

Regarding the tooltip issue: the data for the outer array was bound to the groups that contain the rectangles.

Therefore, you can get it with this.parentNode:

const parentData =;

Regarding the sorting issue, you can sort the nested data with:

        return a.value - b.value

However, this won't make any difference: the order of the bars depend on the domain you passed to x1. So, unless you change the domain for each group (which is not a good practice in data visualisation), you can't sort the bars within groups.

Here is the updated blockbuilder:

Related Query

More Query from same tag