distinguish links and nodes in sankeyPlot using event_data
Nadie ha tomado este issue todavía.
- Lenguaje dominante
- R
- Estrellas
- 2.7k
- Forks
- 641
- Métricas de merge de PR
- Sin PR fusionados en 30 d
Descripción
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)
Guía de contribución
Primeros pasos
- Lee el issue completo y luego la guía de contribución del proyecto.
- Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
- Haz un fork del repositorio y trabaja en una rama.
- Abre un pull request que haga referencia al número del issue.
Línea de trabajo
Comienza con el ejemplo sencillo de Shiny que usa event_data("plotly_click") en el diagrama sankey e inspecciona el pointNumber devuelto para los clics en nodos y enlaces. Traza cómo se representan los eventos de sankeyPlot y determina cómo los datos devueltos pueden distinguir el elemento en el que se hizo clic. Se considera terminado cuando la aplicación puede identificar de forma fiable si un clic apunta a un nodo o a un enlace.
Escrito por el modelo de indexación a partir del texto del issue.
Evaluación
- Stack tecnológico
- r
- Área
- data-visualization
- Tipo de issue
- Nueva funcionalidad
- Dificultad
- 3/5
- Tiempo estimado
- 1-2 días
- Estado de actividad
- Estancado
- Claridad
- Bastante claro
- Aptitud para principiantes
- 35/100