plotly / plotly/plotly.js

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

Offen
#6,872 0 Kommentare 0 Reaktionen 0 zugewiesene Personen Auf GitHub ansehen

Dieses Issue hat noch niemand übernommen.

bug P2
Vorherrschende Sprache
JavaScript
Sterne
18.3k
Forks
2k
Ø Merge
2 T. 12 Std.
Gemergte PRs (30 T.)
28

Beschreibung

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!

Beitragsleitfaden

Beitragsleitfaden öffnen

Erste Schritte

  1. Lies das ganze Issue und danach den Beitragsleitfaden des Projekts.
  2. Schreib ins Issue, dass du es übernimmst — das erspart doppelte Arbeit.
  3. Forke das Repository und arbeite in einem Branch.
  4. Öffne einen Pull Request, der die Issue-Nummer nennt.

Rechercherichtung

Beginnen Sie mit den Axis- und LayoutAxis-Deklarationen, die in types/plotly.js/index.d.ts in den Zeilen 572 und 832 verknüpft sind, und vergleichen Sie sie anschließend mit den dokumentierten layout.yaxis.matches-Werten. Bestätigen Sie, dass der gemeldete Wert y von der Typdefinition akzeptiert wird, und überprüfen Sie die Deklaration anhand eines TypeScript-Beispiels in der Plotly 2.28.0-Umgebung.

Vom Indexierungsmodell aus dem Issue-Text verfasst.

Bewertung

Tech-Stack
javascript, typescript
Bereich
data-visualization
Issue-Typ
Bug
Schwierigkeit
2/5
Geschätzter Aufwand
1-3 Stunden
Aktivitätsstatus
Veraltet
Klarheit
Größtenteils klar
Anfängerfreundlichkeit
45/100

Neue Issues direkt in Ihr Postfach

Eine kurze Übersicht über anfängerfreundliche GitHub-Issues.