in src/SankeyDiagram.js [1068:1110]
function displayStepLabelsIf(
stepLabelText,
stepLabelClassName,
stepLabelStyle,
stepLabelPadding,
nodes,
) {
if (!stepLabelText) {
return null;
}
const depthMapXPos = {};
const depthMapYPos = {};
nodes.forEach(n => {
depthMapXPos[n.depth] = n.x0;
// For the given depth, set the y equal to the highest positioned y value
depthMapYPos[n.depth] = depthMapYPos[n.depth]
? Math.min(n.y0, depthMapYPos[n.depth])
: n.y0;
});
return (
<g className="rct-step-labels" width={innerWidth} height={100}>
{map(depthMapXPos, (x, step) => {
const stepLabelProps = {
y: depthMapYPos[step],
step,
x,
stepLabelText,
stepLabelClassName,
stepLabelPadding,
stepLabelStyle,
};
return (
<SankeyStepLabel key={`rct-step-${step}`} {...stepLabelProps} />
);
})}
</g>
);
}