Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

vue@3.2.47 vue-chartjs@5.2.0 objects as data #1033

Unanswered
IdoS88 asked this question in Q&A
Discussion options

Hi,
I'm new to chartjs.
I want to ask is there an option to pass data as the documentation suggests?
like

 <Bar v-if="chartData !== null" :data="chartData" :options="options" />
....
ChartJS.register(Title, Tooltip, Legend,BarController, BarElement, CategoryScale, LinearScale)
....
 type: 'bar',
 data: {
 datasets: [{
 data: [{ x: 'Sales', y: 20 }, { x: 'Revenue', y: 10 }]
 }]
 }

I tried to copy samples from the documentation because my implementation didn't work properly.
I get the error:

[Vue warn]: Unhandled error during execution of mounted hook 
 at <Anonymous ref=fn<reforwardRef> type="bar" data= 
Object { type: "bar", data: {...} }
 ... > 
 at <Anonymous key=0 data= 
Object { type: "bar", data: {...} }
 options= 
Object { scales: {...}, parsing: {...} }
 > 
 at <Graphs> 
 at <VMain> 
 at <VApp> 
 at <VLayout> 
 at <VCard> 
 at <App> 
 at <App>
Uncaught TypeError: nextDatasets is undefined
 setDatasets vue-chartjs.js:78
 cloneData vue-chartjs.js:96
 renderChart vue-chartjs.js:127
 createHook chunk-SE5EWVSA.js:3455
 callWithErrorHandling chunk-SE5EWVSA.js:1415
 callWithAsyncErrorHandling chunk-SE5EWVSA.js:1423
 __weh chunk-SE5EWVSA.js:3439
 flushPostFlushCbs chunk-SE5EWVSA.js:1570
 render2 chunk-SE5EWVSA.js:6141
 mount chunk-SE5EWVSA.js:4791
 mount chunk-SE5EWVSA.js:8688
 <anonymous> main.ts:23

if so, what are the plugins required for that to work?

You must be logged in to vote

Replies: 0 comments

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
1 participant

AltStyle によって変換されたページ (->オリジナル) /