[Chartjs]-Set custom colours for tooltip squares Chart.js

2👍

You can wrap Chart.MultiTooltip to put in your colors and the call the actual tooltip draw.

var originalDraw = Chart.MultiTooltip.prototype.draw;
Chart.MultiTooltip.prototype.draw = function() {
    this.legendColors[0].fill = "green";
    this.legendColors[1].fill = "blue"
    originalDraw.call(this, arguments)
}

Fiddle – https://jsfiddle.net/fxts741r/

Leave a comment