Using backgroundImageUrl on self hosted instance

Like GitHub issue #142, I was also unable to use the BackgroundImageURL running locally on my machine.

Is there any configuration? I couldn’t find the plugin to install or much less the code implementation to work. I tried editing the code, but to no avail.

Something like:

// Background image plugin
  chart.plugins.push({
    id: 'background-image',
    beforeDraw: chartInstance => {
      if (backgroundImageURL) {
        // Chart.js v3 provides `chartInstance.chart` as `chartInstance`
        const chart = chartInstance.chart ? chartInstance.chart : chartInstance;
        const { ctx } = chart;
        const image = new canvas.Image();
        image.src = backgroundImageURL;

        // Draw the image on the canvas as the background
        ctx.drawImage(image, 0, 0, chart.width, chart.height);
      }
    },
  });