I'm currently working on using Chartjs
to create and control a chart within a Vue component. I'm feeling a bit lost as to where exactly in the script tags I should initialize the chart instance
var myChart = new Chart(ctx, {...});
after importing the chartjs
library. My project is utilizing a Vue CLI Webpack setup.
In essence, I'm unsure whether I should initialize it inside or outside of the
export default {}
block. And if it's inside, should it be right after opening the curly braces or perhaps inside thedata()
function?Additionally, are the actual values for the chart supposed to be within the same scope where I initialize the chart instance?
I would greatly appreciate help on how to dynamically change the values of the bars in the chart by inputting values from fields below the chart.
This question is part of a test task for a Junior Front-end developer position. Any assistance would be incredibly valuable!
Thank you in advance!