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.

Is it possible to integrate a plugin into react-chartjs? For example https://github.com/xch89820/Chart.Funnel.js

I tried using

Chart.pluginService.register({
		// something
	});

with no success.

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Comments:32

github_iconTop GitHub Comments

71reactions
dbrodie122commented, Nov 17, 2017

@brianbolnick I had the same question about the Data Labels plugin and got it to work, though maybe not precisely how it was intended.

npm install chartjs-plugin-datalabels

The documentation had no references (that I saw) as to the proper way to import and use it via npm, so I just tried import 'chartjs-plugin-datalabels' in the container component that held my charts.

Voila! Data labels on my charts.

screen shot 2017-11-16 at 8 14 56 pm

After that, you can pass the plugins property to your options object for your chart, and set things how you like according to the docs

const options = {
  responsive: true,
  plugins: {
    datalabels: {
      color: 'black'
    }
  }
}

Class PieChart extends React.Component {
  ...
  render(){
    return(
      <div>
          <Pie data={data} options={options}/>
      </div>
      )
   }
}

This is the simplest solution I’ve found so far.

18reactions
cwkeamcommented, Jun 25, 2018

That method is not working for me with: ‘chartjs-plugin-annotation’

import ‘chartjs-plugin-annotation’; …

<Line … options={{ maintainAspectRatio: false, lineTension: 0, … plugins:{ annotation: { events: [“click”], annotations: [ { drawTime: “afterDatasetsDraw”, id: “hline”, type: “line”, mode: “horizontal”, scaleID: “y-axis-0”, value: 30, borderColor: “black”, borderWidth: 5, label: { backgroundColor: “red”, content: “Test Label”, enabled: true }, onClick: function(e) { // The annotation is is bound to the this variable console.log(“Annotation”, e.type, this); } }] } }}/>

screen shot 2018-06-25 at 5 49 20 pm

I simply can not see the horizontal line.

I copied the code for annotations from: https://codepen.io/anon/pen/aKjevd which does basically what I need mine to do.

Read more comments on GitHub >

github_iconTop Results From Across the Web

eslint-plugin-import - npm
This plugin intends to support linting of ES2015+ (ES6+) import/export syntax, and prevent issues with misspelling of file paths and import ...
Read more >
Import any XML or CSV File to WordPress – WordPress plugin
WP All Import is an extremely powerful importer that makes it easy to import any XML or CSV file to WordPress.
Read more >
WP All Import: WordPress XML & CSV Importer Plugin
The best import export plugin for WordPress & WooCommerce. Complete, granular control of your data with an easy to use drag & drop...
Read more >
7 WordPress Import Plugins for Simple Site Migrations
Explore the seven best WordPress plugins to easily import data to or export data from your WordPress website.
Read more >
Importing a Plugin - IBM
On the Plugin Manager page (Engine > Plugins), click Import Plugin. The Upload an Action Plugin File for Import dialog appears. · Click...
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