Programmatically assigning/clearing the pointer (tip) value
まだ誰も着手していません。
評価
- 難易度
- 5/5
- 見積もり時間
- 1週間以上
- 初心者へのやさしさ
- 25/100
- issue の種類
- 機能追加
- 明瞭さ
- 説明が足りない
- 活発さ
- 停滞
- 技術スタック
- javascript
調査の方向性
まず、既存のポインターと tip のインタラクション動作を確認します。これには、各 Plot インスタンスが tip の状態をどのように追跡し、ポインターが指している値をどのように公開するかも含まれます。提案されている plot.value、mark.point/pointIndex、mark.tip.point の各 API を比較します。別々の plot 間でポインターを設定または解除でき、データの選択が曖昧にならない、サポート対象の API を選定できれば完了です。
索引モデルが issue の本文から書いたものです。
説明
I have a set of plots (effectively small multiples) but they are generated with separate instances of Plot.plot. These plots have a tip, and I would like to ensure that at most one tip is visible at a time across plots. Since Plot tracks the tip state within each rendered plot separately, if I do nothing then I can click on each plot to make the tip sticky, and end up with many simultaneously visible tips. This is especially noticeable on mobile when it often occurs unintentionally (because tips are effectively sticky by default and are hard to clear).
I can clear the tip programmatically like so:
plot.dispatchEvent(new PointerEvent("pointerdown", {pointerType: "mouse", bubbles: true}));
But, I thought it would be nicer if there were a more discoverable and supported API. Here are a few possibilities I’m considering.
1. Assigning plot.value
plot.value = null;
This would be symmetric to getting the pointed value, which is appealing. But I think it’s too ambiguous for setting it: you’d need to set it to the exact datum, which wouldn’t work in many cases when the data is not unique. Plus you could have multiple marks with pointer interactions — maybe you want to control them independently, or at least maybe they each need different hints to know what should be pointed.
2. A mark.point method
mark.point(value);
mark.pointIndex(index); // or if an index is preferred
If a mark has the pointer interaction applied, a mark.point method is assigned to the mark, allowing the pointed value to be controlled programmatically. Assigning a new value re-renders the mark (via the render transform) and re-assigns plot.value, but does not emit an input event or re-render other marks. In cases where it is awkward to specify the pointed value by data, mark.pointIndex(index) can be used to specify the index of the pointed data. mark.point(value) is a convenience method for mark.pointIndex(data.indexOf(value)).
When using the tip option, it could be mark.tip.point(value) for the same effect.
This approach requires retaining a reference to the mark with the pointer interaction applied (or equivalently the mark with the tip applied), but that should be reasonable. I suppose we could also have plot.point that points at all pointer’d marks, too.
- 主要言語
- HTML
- スター
- 5.4k
- フォーク
- 246
- PR マージ指標
- 30日以内にマージされた PR はありません
環境構築
- Dockerfile・Docker Compose ファイルなし
- プルリクエストのテンプレートなし
- コントリビューションガイドを読む
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
observablehq/plot のほかの issue
-
[Types] Wrong recursion in Mark’s _tip_ option再び着手できるかも このイシューのプルリクエストはマージされずにクローズされました。 オープンbug
難易度 2/5 1〜3時間 初心者へのやさしさ 72/100
observablehq/plot#2459 · リアクション 1 件 ·
-
難易度 2/5 1〜3時間 初心者へのやさしさ 68/100
observablehq/plot#2453 ·
-
Inconsistent type definition of _scale_._transform_対応中かも このイシューにリンクされたプルリクエストがオープン中、またはマージ済みです。 オープンbug
難易度 1/5 1時間未満 初心者へのやさしさ 85/100
observablehq/plot#2451 ·
-
難易度 1/5 1時間未満 初心者へのやさしさ 85/100
observablehq/plot#2447 · コメント 2 件 ·
-
Channel documentation with a section describing z再び着手できるかも @LeonxLJX が 39 日前に担当しましたが、オープン中のプルリクエストはありません。 オープンdocumentation
難易度 2/5 1〜3時間 初心者へのやさしさ 72/100
observablehq/plot#1533 · コメント 3 件 · リアクション 1 件 ·
observablehq/plot の issue をすべて見る
似ている issue
-
難易度 2/5 1〜3時間 初心者へのやさしさ 72/100
メンテナーはふだん 1 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 72/100
nautechsystems/nautilus_trader#5287 ·
メンテナーはふだん 1 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 78/100
zerocracy/judges-action#2714 ·
メンテナーはふだん 8 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 62/100
gofish-graphics/gofish-graphics#1135 ·
メンテナーはふだん 1 日以内に返信
-
[BUG]: Single-color requests raise ZeroDivisionError in palette helpers対応中かも @MokiMeow が 1 日前に担当しました。 オープン
難易度 2/5 1〜3時間 初心者へのやさしさ 82/100
メンテナーはふだん 1 日以内に返信