mirror of
https://github.com/KevinMidboe/vue-chartjs.git
synced 2025-10-29 18:00:20 +00:00
Add support for inline plugins
This commit is contained in:
@@ -56,18 +56,23 @@ export default Vue.extend({
|
||||
barPercentage: 0.2
|
||||
}]
|
||||
}
|
||||
}
|
||||
},
|
||||
plugins: []
|
||||
}
|
||||
},
|
||||
|
||||
methods: {
|
||||
addPlugin (plugin) {
|
||||
this.plugins.push(plugin)
|
||||
},
|
||||
renderChart (data, options) {
|
||||
let chartOptions = mergeOptions(this.defaultOptions, options)
|
||||
this._chart = new Chart(
|
||||
this.$refs.canvas.getContext('2d'), {
|
||||
type: 'bar',
|
||||
data: data,
|
||||
options: chartOptions
|
||||
options: chartOptions,
|
||||
plugins: this.plugins
|
||||
}
|
||||
)
|
||||
this._chart.generateLegend()
|
||||
|
||||
Reference in New Issue
Block a user