What problem does this feature solve?
There seems to be no way to accurately prevent a label for a ReferenceLine from exceeding the bounds of the view box. The viewBox argument to the custom function always has a width: 0.

The following screen shot shows how my label renders when it's positioned toward the right bound of the box. If I knew the width of the box I could shift it left so that the whole label is visible.

Here's the markup for the actual label:
<g>
<rect
x={rectX}
y={y}
fill={markerFill}
stroke={markerStroke}
width={rectWidth}
height={rectHeight}
rx={3}
ry={3}
/>
<text
x={rectX + rectWidth / 2}
y={y + rectHeight / 2}
dominantBaseline="middle"
textAnchor="middle"
fill={markerText}
>
{text}
</text>
</g>
The problem is that I have no way to calculate the value of rectX since I do not know how wide the viewBox is.
What does the proposed API look like?
Pass the actual width of the view box to the label function.
What problem does this feature solve?
There seems to be no way to accurately prevent a
labelfor aReferenceLinefrom exceeding the bounds of the view box. TheviewBoxargument to the custom function always has awidth: 0.The following screen shot shows how my label renders when it's positioned toward the right bound of the box. If I knew the width of the box I could shift it left so that the whole label is visible.
Here's the markup for the actual label:
The problem is that I have no way to calculate the value of
rectXsince I do not know how wide theviewBoxis.What does the proposed API look like?
Pass the actual width of the view box to the label function.