0👍
PointElement
should already be registered if you registered registrables
. One way I can think of for tricking the system to replace it, would be to change its static id
before (first) registration, in a sequence like this (pure js):
import {Chart, PointElement, registerables} from "./chart.js";
PointElement.id = '_point'; // not used
class CustomPointElement extends PointElement {
draw(ctx, area){
//.....
}
}
CustomPointElement.id = 'point';
// will register CustomPointElement under point
Chart.register(...registerables);
Chart.register(CustomPointElement);
This works (tested with chartjs 4.2, but should work with 3.9) because what matters is the key under which the Element is registered, and that is taken from the static id (and should be point
).
- Chartjs-Chart.js chart doesn't render when using Angular 2
- Chartjs-Displaying dataset labels in Chart.js line graph
Source:stackexchange.com