With react-chartjs it was possible to retrieve the canvas by using _refs_ like this:
Component:
<Line ref="linegraph" data={chartData} options={chartOptions} />
Code:
const canvas = this.refs.linegraph.getCanvas();
For some reason I cannot do the same with react-charjs-2, what would be the correct way to do that?
Hey @RamonBeast ,
Thanks for reporting.
It works as https://github.com/gor181/react-chartjs-2#chart-instance
So in your case it would be:
this.refs.linegraph.chart_instance
Please try and let me know.
Thank you,
Goran
Thank you very much @gor181, I have no idea how I missed that in the home page :/.
I still can't access the canvas anyway. Shouldn't getCanvas() be accessible directly through the chart instance? Like this I:
this.refs.linegraph.chart_instance.getCanvas()
I keep getting:
TypeError: this.refs.linegraph.chart_instance.getCanvas is not a function
Thank you again for helping!
@RamonBeast Inspecting chart_instance there is no .getCanvas() function but you can get it from chart_instance.chart.ctx
Thanks @jiayihu, you are right.

@RamonBeast, please check as @jiayihu instructed.
You may also check the image I have just uploaded.
In case you have further questions feel free to reopen the issue.
Most helpful comment
@RamonBeast Inspecting
chart_instancethere is no.getCanvas()function but you can get it fromchart_instance.chart.ctx