plotly / plotly/plotly.js

Type definition error: Type `{ matches: string; }` is not assignable to type `Partial<LayoutAxis>`

Aperta
#6,872 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 am getting a typescript error when I try to set 'y' in LayoutAxis.matches.
If I ignore this error and run the program, the y2 axis is as expected.

Environments

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

Declared here

Axis: https://github.com/DefinitelyTyped/DefinitelyTyped/blob/master/types/plotly.js/index.d.ts#L572
LayoutAxis: https://github.com/DefinitelyTyped/DefinitelyTyped/blob/master/types/plotly.js/index.d.ts#L832

Document

https://plotly.com/javascript/reference/layout/yaxis/#layout-yaxis-matches

matches
Parent: layout.yaxis
Type: enumerated , one of ( "/^x([2-9]|[1-9][0-9]+)?( domain)?$/" | "/^y([2-9]|[1-9][0-9]+)?( domain)?$/" )
If set to another axis id (e.g. x2, y), the range of this axis will match the range of the corresponding axis in data-coordinates space. Moreover, matching axes share auto-range values, category lists and histogram auto-bins. Note that setting axes simultaneously in both a scaleanchor and a matches constraint is currently forbidden. Moreover, note that matching axes must have the same type.

SS

スクリーンショット 2024-01-30 16 43 52

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

Inizia con le dichiarazioni di Axis e LayoutAxis collegate in types/plotly.js/index.d.ts alle righe 572 e 832, quindi confrontale con i valori documentati di layout.yaxis.matches. Conferma che il valore y segnalato sia accettato dalla definizione del tipo e verifica la dichiarazione con un esempio TypeScript usando l’ambiente Plotly 2.28.0.

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
45/100

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.