Is it possible to bind a chart to a ref in Vue.js 3.x? #3847
Unanswered
fearthelettuce
asked this question in
Q&A
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
I'm trying to create a chart bound to a ref in Vue.js and it keeps adding the chart at the bottom of the screen, which seems to be default behavior when it can't find a div with ID "chart". I found an example of someone using Vue 2 this.$refs.chart, but that no longer works in vue 3, possibly after this default behavior was added. Is this no longer possible? Or what am I doing wrong?
Example code:
`
<script setup lang="ts"> import { ref, onMounted } from 'vue' import bb, {bar} from 'billboard.js' const chartOptions = { bindto: bbChart.value, data: { type: bar(), columns: [ ['x', 2012, 2013, 2014, 2015, 2016, 2017], ['data1', 30, 200, 100, 170, 150, 250], ], x: 'x', } onMounted(() => { bb.generate(chartOptions) }) `
Beta Was this translation helpful? Give feedback.
All reactions