[Chartjs]-(Vue, ChartJS) Create gradient background for chart from child component canvas context

4👍

You can access this.$refs.canvas in your chart component.
If you want to access it from your parent component there are several ways.

The fast unclean way is over this.$children
https://v2.vuejs.org/v2/api/#vm-children

A better way would be to setup the gradient stuff into a own method and pass in all data as props to your chart component.

Leave a comment