Closed espinielli closed 1 year ago
D3’s Legend component uses a “bleeding out” strategy (style: "overflow: visible") which means that the contents outside the SVG’s bounding box are visible. But the image is cut from the bounding box.
There are two ways to change this:
add an option like marginLeft: 16
to the call to Legend().
In cases where such an option doesn't exist (not for this component, but say, in general), you could wrap the cell with HTML:
<div style="margin-left: 16px; width: 352px">${Legend(interpolator, {
title: "Overflight daily variation",
tickFormat: "+%"
})}</div>
(The second solution is new.)
Sorry it took us a long time to identify a good solution.
Describe the bug The left (tick) label of a Legend gets truncated on "Download SVG" or "Download PNG".
To Reproduce See https://observablehq.com/@espinielli/legend-tick-lable-truncated-on-export
Steps to reproduce the behavior:
Expected behavior A full exported Legend with no truncated labels.
Screenshots See notebook
Desktop (please complete the following information):