You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I currently work around this by using the following chartCallback:
constcanvasOptions: ChartJSNodeCanvasOptions={
width,
height,
backgroundColour,chartCallback: (ChartJS)=>{ChartJS.register({id: 'my_background_color',beforeDraw: (chart,_options)=>{constctx=chart.ctx;ctx.save();ctx.fillStyle=backgroundColour;ctx.fillRect(0,0,width,chart.height);// <- note the `chart.height` here, which gives the correct result. I am not sure why just `width` works though. It's a bit odd.ctx.restore();}});}};
The text was updated successfully, but these errors were encountered:
When setting the backgroundColour and
devicePixelRatio: 2
, the background color is applied to the correct width, but not the full hight.I assume that the issue is that the hight is the one not scaled to the 2x ratio.
Versions
I currently work around this by using the following
chartCallback
:The text was updated successfully, but these errors were encountered: