Tooltip along the length of a segment
Chưa có ai nhận issue này.
- Ngôn ngữ chính
- R
- Star
- 2.7k
- Fork
- 641
- Chỉ số merge pull request
- Không có pull request nào được merge trong 30 ngày
Mô tả
I posted about this here in RStudio community in mid-June but didn't get any responses.
Edit Aug17: Stopped using x-unified hovermode, added new video to show the problem more clearly. Also posted another RStudio community post.
Maybe this feature exists, but I'm missing it? I would like to have a tooltip that extends across the entire length of a segment from add_segments().
Example:
library(plotly)
my_data <- data.frame(
x = c(1, 6), xend = c(5, 10),
y = c(1, 2), yend = c(1, 2),
text = c("First", "Second")
)
plot_ly(my_data, x = ~x, xend = ~xend, y = ~y, yend = ~yend,
text = ~text, hoverinfo = "text") %>%
add_segments()
This will put a tooltip at the beginning and the end of the segment, but users will tend to put their cursor near the middle of the segment and expect a tooltip to appear. Even more importantly, users won't get a tooltip if they are zoomed into the middle of a segment.

I've been getting around this problem by using add_lines() instead, but this is terribly inefficient when I'm trying to plot thousands of these segments at once, and it doesn't solve the zooming problem. E.g.
my_data <- data.frame(
x = c(seq(1, 5, length.out = 10), NA,
seq(6, 10, length.out = 10)),
y = c(rep(1, 10), NA,
rep(2, 10)),
text = c(rep("First", 10), NA,
rep("Second", 10))
)
plot_ly(my_data, x = ~x,y = ~y,
text = ~text, hoverinfo = "text") %>%
add_lines() %>%
layout(hovermode = "x unified")

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.
Hướng nghiên cứu
Bắt đầu tại điểm vào R add_segments() và so sánh với workaround add_lines() được minh họa trong các ví dụ. Tái hiện hành vi hover tại các điểm cuối của segment, ở giữa và sau khi zoom; hoàn thành khi tooltip của một segment xuất hiện trên toàn bộ chiều dài của nó mà không cần workaround.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Đánh giá
- Công nghệ
- plotly, r
- Lĩnh vực
- data-visualization
- Loại issue
- Tính năng
- Độ khó
- 4/5
- Thời gian dự kiến
- 3-5 ngày
- Mức độ hoạt động
- Đình trệ
- Độ rõ ràng
- Khá rõ ràng
- Mức phù hợp với người mới
- 38/100