Chartjs-Chart.js Box Annotations Fill Entire Chart

0👍

This behavior comes from the fact that you did not provide the correct y-axis id and x-axis id in the boxes definition.

I see that you did not put any id for x-axis and y-axis in your chart’s xAxes and yAxes definition, so their default ids are ‘x-axis-0’ and ‘y-axis-0’.

For each of your boxes definition, try changing

'xScaleID' : 'xAxes',
'yScaleID' : 'yAxes' 

into

'xScaleID' : 'x-axis-0',
'yScaleID' : 'y-axis-0' 

Leave a comment