Closed Martijn097 closed 2 years ago
Fixed it.
All you gotta do is add .value.
const gradient = ref('red')
onMounted(() => {
const canvas = lineRef.value.canvasRef;
gradient.value = canvas.getContext('2d').createLinearGradient(0, 0, 0, 400);
gradient.value.addColorStop(0, 'rgba(255, 0,0, 0.9)')
gradient.value.addColorStop(0.5, 'rgba(255, 0, 0, 0.5)');
gradient.value.addColorStop(1, 'rgba(255, 0, 0, 0)');
})
const testData = computed(() => ({
datasets: [
{
backgroundColor: gradient.value
}
]
}));
Hello, thanks for this package!
I was wondering if you guys could help me create a gradient background color on a chart. I have not seen an issue with this yet.
Right now it does console log the canvas ref and it does console log the canvasgradient but Im not really sure what Im doing wrong here.