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.

Chart.js 3.0.0-rc.5: Plugins are not registered correctly if used for specific chart instances.

See original GitHub issue

Expected Behavior

I expect to be able to specify a plugin for a specific chart instance without having to register it globally

Current Behavior

Plugin is not effective. Not all plugin lifecycle events seem to be called when adding a plugin to a specific chart instance.

Steps to Reproduce

https://codepen.io/santa-85/pen/BaQgqYe?editors=1111 To see correct behaviour, add chartjsPluginAnnotation to the Chart.register call

Environment

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Comments:6 (4 by maintainers)

github_iconTop GitHub Comments

1reaction
etimbergcommented, Mar 27, 2021

I added some more documentation on the plugin hooks and added some flow charts on how create/update work. There are other hooks (start/stop) that get called for all plugins on a per-chart basis when a plugin is added/removed from the chart instance.

This specific issue with the annotation plugin is because it was never written to handle being applied inline. Depending on the plugin, and what is needs to do, inline can make sense. For example, a plugin to draw the framerate of the chart animations could likely be done with no options, defaults, or registered elements so adding inline is totally fine.

1reaction
santam85commented, Mar 26, 2021

@etimberg I started testing this only since the first rc version, but I suspect it was there for a while.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Plugins | Chart.js
Plugins can be registered globally to be applied on all charts (a.k.a. global ... To disable a global plugin for a specific chart...
Read more >
Troubleshooting in Athena - AWS Documentation
When you use a CTAS statement to create a table with more than 100 partitions, ... Athena does not support querying the data...
Read more >
1. How to add chartjs-plugin-datalabels to Chart.JS - YouTube
JS 3.0 we can expect more new exciting charts in the near future. About Chart. JS 3 | Chart JS 3 Chart JS...
Read more >
Dynamically update values of a chartjs chart - Stack Overflow
Update: Looks like chartjs has been updated (see comment below). There are some examples up that look very nice: Here's an example of...
Read more >
Migration | chartjs-plugin-streaming - nagix
import {Chart} from 'chart.js'; import ChartStreaming from 'chartjs-plugin-streaming'; Chart.register(ChartStreaming); ...
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