Closed zibous closed 3 years ago
I pushed version 0.1.1 to try to address these issues. Can you test if it works for you?
@kurkle Thank, is working 👍
I am searching for a generic plugin for all charts, but so far had no success. Building a plugin for every chart type is very resource-intensive
Simple for yours, i use the helper to build the gradient color:
const helpers = Chart.helpers;
function addColors(gradient, scale, colors) {
for (const value of Object.keys(colors)) {
const pixel = scale.getPixelForValue(value);
const stop = scale.getDecimalForPixel(pixel);
if (isFinite(pixel) && isFinite(stop)) {
gradient.addColorStop(
Math.max(0, Math.min(1, stop)),
helpers.color(colors[value]).alpha(0.95).rgbString()
);
}
}
}
With the following configuration I get this error: Used with the latest version chart.js (3.0.0-beta.5):
If I adjust the processing of createGradient and addColors then it works: