question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

VueChart.js with inline plugins example

See original GitHub issue

Hi guys, it might not be the place to ask this kind of question, but as a newbie, I don’t really understand how to use plugins …

I’d like to add this plugin PieceLabel to my component below.

export default {
  name: 'pie-chart',
  mixins: [reactiveProp],
  extends: Pie,
  props: {
    options: Object,
    chartData: Object,
  },
  mounted() {
    const { options, chartData, renderChart } = this

    this.addPlugin({
    id: 'pieceLabel',
      beforeInit: function (chart) {
        console.log(chart)
      }
    })

    options: {
      pieceLabel: {
        mode: 'label',
        precision: 1
      },
   }
    renderChart(chartData, params)
  },
}

The issue is how does it recognize the id ?? Thanks a lot

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Comments:7 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
aperturelesscommented, Aug 8, 2018

I guess you are using this one? https://github.com/chartjs/chartjs-plugin-annotation

Well, they say:

To configure the annotations plugin, you can simply add new config options to your chart config.

So have you tried this?


const options = {
	responsive: true,
	title: {
		display: true,
		text: 'Put your other options in here'
	}
	annotation: {
		events: ['click'],
		annotations: []
	}
}


this.renderChart(data, options)
1reaction
winou75commented, Dec 13, 2017

you are a marvellous person.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Plugins | Chart.js
Copied! Plugins can also be defined directly in the chart plugins config (a.k.a. inline plugins):. WARNING. inline plugins are not registered.
Read more >
Using inline plugins · Issue #130 · apertureless/vue-chartjs
I tried doing something like this: this.renderChart(this.datacollection, { responsive: true, maintainAspectRatio: true, legend: { display: false ...
Read more >
Getting Started - vue-chartjs
Getting Started #. vue-chartjs is a wrapper for Chart.js in Vue. You can easily create reuseable chart components. Supports Chart.js v4.
Read more >
vue-chartjs examples - CodeSandbox
Learn how to use vue-chartjs by viewing and forking example apps that make use of vue-chartjs on CodeSandbox. apertureless/vue-chartjs: bar.
Read more >
How to import and use a custom Chart.js plugin in Nuxt ...
The second way is an inline plugin. This needs to be done in your BarChart.vue and goes like this: mounted() { this.addPlugin( Chart....
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found