Reproduction: https://codesandbox.io/s/chart-js-gradient-annotations-broken-8pf3z
It seems that on the first draw, ctx.element does not have x, x2, y nor y2, making it impossible to draw gradients.
These values are only missing on the first draw; You can uncomment line 52 and see that on the first draw green is returned, but after clicking "Force update", the actual gradient works.
Reproduction: https://codesandbox.io/s/chart-js-gradient-annotations-broken-8pf3z
It seems that on the first draw,
ctx.elementdoes not havex,x2,ynory2, making it impossible to draw gradients.These values are only missing on the first draw; You can uncomment line 52 and see that on the first draw
greenis returned, but after clicking "Force update", the actual gradient works.