recharts-to-png
Uses html2canvas to convert a Recharts chart to PNG.
Inspired by these Stack Overflow questions and answers from peter.bartos and AlbertMunichMar.
Install
npm install recharts-to-png
Hook
The recommended way of using recharts-to-png
. It is compatible with React 16.8+, does not rely on findDOMNode
, and is required for React 17:
Deprecated
The original getPngData
function this library offered does not work with React 17 (see #6). This section is still included for backwards compatibility, but will probably be removed at some point along with getPngData
.
Usage
Allows all html2canvas configuration options to be passed: