3👍
A bit late answer but you can extend the shape of the element, not the type of the specific chart, from v2.
For example,
Chart.elements.Rectangle.prototype.draw = function() {
// Do your draw thingy.
}
There’s an issue regarding this one at the official Github repo and also a great example of implementing it.
1👍
Try this for the line chart:
var originalLineController = Chart.controllers.line;
Chart.controllers.line = Chart.controllers.line.extend({
draw: function() {
originalLineController.prototype.draw.apply(this, arguments);
/* own drawing code here */
}
}
You can get the context with:
var ctx = this.chart.chart.ctx;
- [Chartjs]-Bootstrap 3 tabs & Chart.js – charts not loading on tabs
- [Chartjs]-How to limit number of displayed points in chart.js?
Source:stackexchange.com