chartjs / chartjs-plugin-annotation

Annotation plugin for Chart.js
MIT License
607 stars 328 forks source link

Annotations broken when using array syntax #572

Closed elitastic closed 2 years ago

elitastic commented 2 years ago

When writing annotations in array syntax, I get the following error (since version 1.2.0):

Cannot read properties of undefined (reading 'borderCapStyle')

Reproduction:

from

annotation: {
  annotations: {
    annotation1,
    annotation2,
    annotation3
  }
}

to

annotation: {
  annotations: [
    annotation1,
    annotation2,
    annotation3
  ]
}
kurkle commented 2 years ago

Fixed by: https://github.com/chartjs/Chart.js/pull/9969 (not released yet)

I think this only affects the new types.

Edit: some explanation

https://github.com/chartjs/chartjs-plugin-annotation/blob/8f43b3c95318303080c9bfbcebecbfdfa902fc7b/src/annotation.js#L111

elitastic commented 2 years ago

Thanks for your help!