Passing options to renderChart simply doesn't work
See original GitHub issueI’m trying to initialise my line chart with some options. I have my chart as a plugin inside of plugins/LineChart.js
within my Nuxt JS app and do not understand why the options simply don’t work…
import { Line, mixins } from 'vue-chartjs'
const { reactiveProp } = mixins
export default {
extends: Line,
mixins: [reactiveProp],
data () {
return {
localData: null
}
},
mounted () {
this.localData = this.chartData
const options = {
responsive: false,
maintainAspectRatio: false,
legend: {
display: false
}
}
console.log(options)
// this.chartData is created in the mixin.
// If you want to pass options please create a local options object
this.renderChart(this.localData, options)
},
watch: {
chartData: {
handler: function (val, oldVal) {
this.localData = val
},
deep: true
}
}
}
Issue Analytics
- State:
- Created 3 years ago
- Comments:6 (3 by maintainers)
Top Results From Across the Web
Vue.js using chart.js options not working - Stack Overflow
Just pass the options object as a second parameter to the render method. Right now your options are within the first object passed...
Read more >Not understanding options · Issue #93 · apertureless/vue-chartjs
I'm trying to set custom options on a chart. I had tried passing them in as an option, but, that didn't work. So...
Read more >Getting Started - vue-chartjs
For this purpose, you should utilize Vue.js props to pass in chart options and chart data. This way, the parent component itself does...
Read more >Updating Charts - Chart.js
Updating Options. To update the options, mutating the options property in place or passing in a new options object are supported.
Read more >Methods - ApexCharts.js
var chart = new ApexCharts(el, options); chart.render() ... you will find an example of how variable number of parameters are passed to different...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Can you provide a minimal codepen / codesandbox for reproduction?
@sts-ryan-holton try passing a complete options object via a method in the prop. E.g.