plouc / nivo

nivo provides a rich set of dataviz components, built on top of the awesome d3 and React libraries
https://nivo.rocks
MIT License
13.16k stars 1.03k forks source link

The size of the SVG does not adapt to the size of the graph #2587

Open lauradecc opened 5 months ago

lauradecc commented 5 months ago

Is your feature request related to a problem? Please describe. I am using the radial bar with endAngle of 90, so it ocuppies a quarter of the circle. Despite that, the SVG maintains the same distribution, so it makes it really hard to position as needed.

Captura de pantalla 2024-05-10 a las 15 32 15

Describe the solution you'd like I would like the SVG to be the size of the graph, the content itself. As shown in the console under the rect element: Captura de pantalla 2024-05-10 a las 15 34 01

Describe alternatives you've considered I have tried the following:

Does anyone have any ideas I can try? 🙏

Thanks in advance!

plouc commented 5 months ago

This is not supported for the radial bar chart, while 90 degrees is easy to fit, it gets more complicated with less common start/end angles, the pie chart has such feature via the fit property (try changing the start/end angles), you could try to port the feature to the radial bar chart.

plouc commented 5 months ago

There's already a helper available in @nivo/arc, computeArcBoundingBox.