plotly / plotly/plotly.js

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

Aperta
#6,868 0 commenti 0 reazioni 0 assegnatari Vedi su GitHub

Nessuno ha ancora preso questa issue.

bug P2
Lingua principale
JavaScript
Stelle
18.3k
Fork
2k
Merge medio
2g 12h
PR unite (30g)
28

Descrizione

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!

Guida per i contributori

Apri la guida per i contributori

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Direzione di ricerca

Iniziare con la dichiarazione di Annotations.x in types/plotly.js/index.d.ts alle righe indicate, quindi confrontare il relativo tipo con la documentazione di Plotly sulle annotations. Confermare che un valore Date per un asse temporale sia accettato dalla definizione del tipo e convalidare il risultato con un utilizzo minimo di TypeScript che corrisponda al caso segnalato.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Valutazione

Stack tecnologico
javascript, typescript
Ambito
data-visualization
Tipo di issue
Bug
Difficoltà
2/5
Tempo stimato
1-3 ore
Stato di attività
Ferma
Chiarezza
Abbastanza chiara
Idoneità per principianti
35/100

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.