distinguish links and nodes in sankeyPlot using event_data
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 am building a sankey plot using plotly package with R within a Shiny application.
At some point, I use event_data function which returns an index pointNumber which is an integer ranging from 0 to the number of pairwise nodes relationships.
When performing sankeyPlot in plotly you have to specify the node and link arguments. The problem is that pointNumber provides an index which I cannot distinguish between the node or the link.
I would like the app could identify if the user clicks on a node or on a link.
Here is a toy example. Note that when clicking on node "A", pointNumber returns 0, and the same when clicking on link connecting node "A" and node "B".
library(plotly); library(shiny)
ui <- fluidPage(
plotlyOutput("plot"),
verbatimTextOutput("index")
)
server <- function(input, output){
output$index <- renderPrint({
event_data("plotly_click", source="sankeyPlot")
})
output$plot <- renderPlotly({
plot_ly(
source = "sankeyPlot",
type = "sankey",
arrangement = "fixed",
node = list(label = c("A","B","C","D"), hoverinfo="none"),
link = list(source=c(0,0,1,2), target=c(1,2,3,3), value=c(2,5,2,1), hoverinfo="none")
)
})
}
shinyApp(ui, server)
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 với ví dụ Shiny đơn giản sử dụng event_data("plotly_click") trên biểu đồ sankey và kiểm tra pointNumber được trả về đối với các lần nhấp vào node và link. Theo dõi cách các sự kiện sankeyPlot được biểu diễn và xác định cách dữ liệu được trả về có thể phân biệt phần tử được nhấp. Hoàn thành khi ứng dụng có thể xác định một cách đáng tin cậy liệu lần nhấp có nhắm đến node hay link.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Đánh giá
- Công nghệ
- r
- Lĩnh vực
- data-visualization
- Loại issue
- Tính năng
- Độ khó
- 3/5
- Thời gian dự kiến
- 1-2 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
- 35/100