vue-chartjs
vue-chartjs copied to clipboard
Legacy multiple annotations
Fix or Enhancement?
Resolves #909 – Multiple instances of a chart cannot be rendered at once if using the Annotations plugin
Extends the _chartRef object to handle multiple instances of vue-chartjs wrapper components, in Vue 2, when the annotations plugin is present. Assigns a unique, random ID to each one.
Sandboxes
Reproduces the issue with annotation plugin (multiple instances): https://codesandbox.io/s/practical-bas-2irrtp
Fixes the issue with updated compiled vue-chartjs legacy component: https://codesandbox.io/s/twilight-feather-ymgud6
Feel free to suggest improvements. I believe most of #818 could be factored out to treat this state management the same, even when the annotations plugin is not present, removing the computed property & $data._chart.
- [x] All tests passed
Environment
- OS: macOS Monterey
- NPM Version: 8.10.0
CI Test failures seem unrelated to my changes
@kidGodzilla Hi. Thank you for the PR!
Please pull changes from main to fix CI.