plotly / plotly/plotly.js

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

Ouverte
#6,868 0 commentaires 0 réactions 0 personnes assignées Voir sur GitHub

Personne n'a encore pris cette issue.

bug P2
Langage dominant
JavaScript
Étoiles
18.3k
Forks
2k
Merge moyen
2 j 12 h
PR mergées (30 j)
28

Description

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!

Guide de contribution

Ouvrir le guide de contribution

Par où commencer

  1. Lisez l'issue en entier, puis le guide de contribution du projet.
  2. Signalez en commentaire que vous la prenez — cela évite que deux personnes fassent le même travail.
  3. Forkez le dépôt et travaillez sur une branche.
  4. Ouvrez une pull request qui référence le numéro de l'issue.

Piste de recherche

Commencez par la déclaration de Annotations.x dans types/plotly.js/index.d.ts aux lignes référencées, puis comparez son type avec la documentation de Plotly relative aux annotations. Confirmez qu’une valeur Date pour un axe de dates est acceptée par la définition de type, et validez le résultat avec une utilisation minimale de TypeScript correspondant au cas signalé.

Rédigé par le modèle d'indexation à partir du texte de l'issue.

Évaluation

Stack technique
javascript, typescript
Domaine
data-visualization
Type d'issue
Bug
Difficulté
2/5
Temps estimé
1-3 heures
Activité
À l'abandon
Clarté
Plutôt claire
Accessibilité débutants
35/100

Recevez les nouvelles issues par e-mail

Un résumé court des issues GitHub adaptées aux débutants.