Closed kqikz closed 1 year ago
This seems to fix an issue where for pie charts we are attempting to use a point system not the radian one. throws an error about x not being defined.
Would it be possible to move this in?
I am having this same issue on the main branch, is there an official fix?
chartjs-plugin-datalabels.esm.js:118 Uncaught TypeError: Cannot read properties of null (reading 'x')
at orient (chartjs-plugin-datalabels.esm.js:118:19)
at Object.fallback [as positioner] (chartjs-plugin-datalabels.esm.js:342:13)
at coordinates (chartjs-plugin-datalabels.esm.js:838:21)
at Object.draw (chartjs-plugin-datalabels.esm.js:1009:18)
at Object.afterDatasetsDraw (chartjs-plugin-datalabels.esm.js:1302:12)
at callback (helpers.core.ts:109:15)
at PluginService._notify (core.plugins.js:60:11)
at PluginService.notify (core.plugins.js:42:25)
at Chart.notifyPlugins (core.controller.js:1148:26)
at Chart._drawDatasets (core.controller.js:787:10)
Unfortunately, the suggested fix is not acceptable because el instanceof ArcElement
behaves differently than el.constructor.id == "arc"
(same for all other tests). First case tests if el
inherits from ArcElement
(directly or indirectly) while in the second case, el
must be of class ArcElement
.
However, I believe the issue should be solved inside your project so the plugin depends on the exact same Chart.js package used to create the chart (i.e, ArcElement
used in this check is the same object as ArcElement
used by the chart). Having different ArcElement
classes in your project does not seem correct.
instanceof not working anymore in chart.js 4.0.1, switched to class name isntead