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

ChartJS instance always returns null #1054

Unanswered
JoaoHCopetti asked this question in Q&A
Discussion options

I just can't get the chart instance in Vue ChartJS, it always returns null.

  • Vue: 2.7
  • Vue ChartJS: 5.2.0
  • ChartJS: 4.3.3
import { Line as LineChart } from 'vue-chartjs'
import { Chart as ChartJS, Tooltip, CategoryScale, LinearScale, PointElement, LineElement, Legend } from 'chart.js'
import zoomPlugin from 'chartjs-plugin-zoom'
ChartJS.register(CategoryScale, Legend, Tooltip, LinearScale, PointElement, LineElement, zoomPlugin)
<script>
export default {
 components: {
 LineChart
 },
 methods: {
 test () {
 this.$refs.lineChart.chart // null
 this.$refs.lineChart.chartInstance // null too
 }
 }
}
</script>
<template>
 <LineChart
 id="my-chart-id"
 ref="lineChart"
 />
</template>
You must be logged in to vote

Replies: 1 comment

Comment options

was an answer ever found for this?

You must be logged in to vote
0 replies
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet

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