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.07k stars 1.02k forks source link

Ref is undefined in Pie/ResponsivePieCanvas charts #2058

Closed cryptoTeq closed 1 year ago

cryptoTeq commented 2 years ago

Describe/explain the bug ref to Canvas element is undefined in Pie/ResponsivePieCanvas charts. But it works perfectly fine in the ResponsiveBarCanvas and returns a reference to the Canvas.

To Reproduce Please check the CodeSandBox. CodeSandBox 1) Click on the button on the top 2) Check the value in the console

Expected behavior ref contains a reference to the html canvas.

Screenshots image

stale[bot] commented 1 year ago

This issue has been automatically marked as stale. If this issue is still affecting you, please leave any comment (for example, "bump"), and we'll keep it open. We are sorry that we haven't been able to prioritize it yet. If you have any new additional information, please include it with your comment!

stale[bot] commented 1 year ago

Closing this issue after a prolonged period of inactivity. If this issue is still present in the latest release, please create a new issue with up-to-date information. Thank you!

Dlina1502 commented 1 year ago

I have the same problem, still not solved.

YMMTech commented 1 year ago

still not solved

YMMTech commented 1 year ago

a work around is to wrap your component in a div with for instance an id and get the element by selecting it from the dom instead of using a ref : const downloadpie = () => { ... const PieCanvas = document.getElementById('pieCanvas').querySelector('canvas'); ... }

UdayKumar-Heeddata commented 5 months ago

Is there any solution for this @plouc @wyze @tkonopka Please let me know

plouc commented 4 months ago

There's no solution atm, it needs to be implemented, but you could use the workaround suggested by @YMMTech in the meantime.

UdayKumar-Heeddata commented 4 months ago

ok @plouc Thank you