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:
@@ -39,11 +39,15 @@ export default Vue.extend({
|
||||
data () {
|
||||
return {
|
||||
defaultOptions: {
|
||||
}
|
||||
},
|
||||
plugins: []
|
||||
}
|
||||
},
|
||||
|
||||
methods: {
|
||||
addPlugin (plugin) {
|
||||
this.plugins.push(plugin)
|
||||
},
|
||||
renderChart (data, options) {
|
||||
let chartOptions = mergeOptions(this.defaultOptions, options)
|
||||
|
||||
@@ -51,7 +55,8 @@ export default Vue.extend({
|
||||
this.$refs.canvas.getContext('2d'), {
|
||||
type: 'pie',
|
||||
data: data,
|
||||
options: chartOptions
|
||||
options: chartOptions,
|
||||
plugins: this.plugins
|
||||
}
|
||||
)
|
||||
this._chart.generateLegend()
|
||||
|
||||
Reference in New Issue
Block a user