Programmatically assigning/clearing the pointer (tip) value
Chưa có ai nhận issue này.
Đánh giá
- Độ khó
- 5/5
- Thời gian dự kiến
- Hơn một tuần
- Mức phù hợp với người mới
- 25/100
- Loại issue
- Tính năng
- Độ rõ ràng
- Cần làm rõ
- Mức độ hoạt động
- Đình trệ
- Công nghệ
- javascript
- Lĩnh vực
- data-visualization
Hướng nghiên cứu
Bắt đầu bằng cách xem xét hành vi tương tác con trỏ và tip hiện có, bao gồm cách mỗi thực thể Plot theo dõi trạng thái tip của nó và cung cấp giá trị được trỏ tới. So sánh các API được đề xuất plot.value, mark.point/pointIndex và mark.tip.point; công việc được xem là hoàn tất khi chọn được một API được hỗ trợ có thể gán hoặc xóa các con trỏ giữa các plot riêng biệt mà không gây ra việc chọn dữ liệu mơ hồ.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Mô tả
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.
- Ngôn ngữ chính
- HTML
- Star
- 5.4k
- Fork
- 246
- Chỉ số merge pull request
- Không có pull request nào được merge trong 30 ngày
Chuẩn bị môi trường
- Không có Dockerfile hay tệp Docker Compose
- Không có mẫu pull request
- Đọc hướng dẫn đóng góp
Bắt đầu từ đâu
- Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
- Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
- Fork repository và làm thay đổi trên một nhánh.
- Mở pull request có tham chiếu số hiệu của issue.
Issue khác của observablehq/plot
-
[Types] Wrong recursion in Mark’s _tip_ optionCó thể làm lại được Pull request cho issue này đã bị đóng mà không được merge. Đang mởbug
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 72/100
observablehq/plot#2459 · 1 reaction ·
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 68/100
observablehq/plot#2453 ·
-
Inconsistent type definition of _scale_._transform_Có thể đã có người làm Có pull request liên kết đang mở hoặc đã được merge. Đang mởbug
Độ khó 1/5 Dưới một giờ Mức phù hợp với người mới 85/100
observablehq/plot#2451 ·
-
Độ khó 1/5 Dưới một giờ Mức phù hợp với người mới 85/100
observablehq/plot#2447 · 2 bình luận ·
-
Channel documentation with a section describing zCó thể làm lại được @LeonxLJX đã nhận 38 ngày trước và không có pull request nào đang mở. Đang mởdocumentation
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 72/100
observablehq/plot#1533 · 3 bình luận · 1 reaction ·
Tất cả issue của observablehq/plot
Issue tương tự
-
Plot confusion matrixĐang mởevaluation
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 68/100
-
Tracking: Submit errors aren't tracked in the transaction flowCó thể đã có người làm @oceans404 đã nhận hôm nay. Đang mởbug
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 72/100
stellar/laboratory#2212 ·
Maintainer thường phản hồi trong vòng 4 ngày
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 72/100
Graphify-Labs/graphify#4241 · 1 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Bug: dual_axis_lines() crashes on 2D column vectors and mutates caller opts in-placeCó thể đã có người làm @rishi919-rgb đã nhận hôm nay. Đang mở
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 74/100
Maintainer thường phản hồi trong vòng 6 ngày
-
beginner friendly community contributions-welcome documentation good first issue hacktoberfest help wanted up-for-grabs
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 78/100
Maintainer thường phản hồi trong vòng 1 ngày