indiespirit / react-native-chart-kit

📊React Native Chart Kit: Line Chart, Bezier Line Chart, Progress Ring, Bar chart, Pie chart, Contribution graph (heatmap)
https://expo.io/@indiespirit/react-native-chart-kit
MIT License
2.85k stars 658 forks source link

How to get Image (svg or png) of chart? #714

Open budwol opened 10 months ago

budwol commented 10 months ago

I tried:

<Svg ref = {this.props.svgRef}>
   <LineChart />
</Svg>

...
onPress={() => {
svgRef.current?.toDataURL((base64) => {                                    
console.log(base64);
);

but the base64 just contains an empty image.

the graph i want to get as svg or png looks like this:

image

can anyone help?