plotly / plotly/plotly.js

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

オープン
#6,868 コメント 0 件 リアクション 0 件 担当者 0 名 GitHub で見る

まだ誰も着手していません。

bug P2
主要言語
JavaScript
スター
18.3k
フォーク
2k
平均マージ
2日 12時間
マージ済み PR(30日)
28

説明

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!

コントリビューションガイド

コントリビューションガイドを開く

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

調査の方向性

参照されている行の types/plotly.js/index.d.ts にある Annotations.x の宣言から始め、次にその型を Plotly の annotation ドキュメントと比較します。日付軸に対する Date 値が型定義で受け入れられることを確認し、報告されたケースに対応する最小限の TypeScript の使用例で結果を検証します。

索引モデルが issue の本文から書いたものです。

評価

技術スタック
javascript, typescript
領域
data-visualization
issue の種類
バグ
難易度
2/5
見積もり時間
1〜3時間
活発さ
停滞
明瞭さ
おおむね明確
初心者へのやさしさ
35/100

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。