plotly.js icon indicating copy to clipboard operation
plotly.js copied to clipboard

Type definition error: Type Date is not assignable to type `Annotations.x`

Open yKicchan opened this issue 2 years ago • 0 comments

Hi,

I'm getting typescript error when trying to set Date object for Annotations.x in axis type is date chart. Note that if you ignore this error and run the program, the position of the X in the annotation will be as expected.

Environments

  • "plotly.js":"2.28.0"
  • "@types/plotly.js":"2.12.32"

Declared here

https://github.com/DefinitelyTyped/DefinitelyTyped/blob/master/types/plotly.js/index.d.ts#L2006-L2014

Document

https://plotly.com/javascript/reference/layout/annotations/#layout-annotations-items-annotation-x

x Parent: layout.annotations[] Type: number or categorical coordinate string Sets the annotation's x position. If the axis type is "log", then you must take the log of your desired range. If the axis type is "date", it should be date strings, like date data, though Date objects and unix milliseconds will be accepted and converted to strings. If the axis type is "category", it should be numbers, using the scale where each category is assigned a serial number from zero in the order it appears.

SS

スクリーンショット 2024-01-26 17 58 06

Thank you for the support!

yKicchan avatar Jan 26 '24 09:01 yKicchan