Closed movy closed 10 months ago
this chart js extension is not a plugin it but a handful of components that need to be registered if used in ESM module .
i..e
import { Chart, LinearScale, CategoryScale } from 'chart.js';
import { BoxPlotController, BoxAndWiskers } from '@sgratzl/chartjs-chart-boxplot';
// register controller in chart.js and ensure the defaults are set
Chart.register(BoxPlotController, BoxAndWiskers, LinearScale, CategoryScale);
Yes, apparently PrimeVue chartjs component does not expose Chart.register()
call, so I'll raise it with them.
"@sgratzl/chartjs-chart-boxplot": "^4.2.7"
I've read other issues with this error, but still cannot understand how to properly init BoxPlot plugin when
Chart.register()
is not exposed.Their canonical way to attach plugins is:
And it seem to work with other plugins, but not with BoxPlot.
Full repro: https://stackblitz.com/edit/mgfvrw-3xiqfx?file=src%2FApp.vue
(the page is empty as it fails at setup stage, please see console for errors)
I ended up using
vue-chartjs: "^5.2.0"
for charts only, so in general this plugin works fine within vue, but only with.register()
method.As it's not clear whether it's a bug or usage specifics, so I crossposted it their repo also: https://github.com/orgs/primefaces/discussions/187#discussioncomment-7510393
Thanks heaps for the plugin! Very useful.