Closed FabioBedin closed 1 year ago
Sorry, I missed this but support for it was dropped in v5 in favour of emphasis
.
Try this:
value <- rnorm(10, 10, 2)
nodes <- data.frame(
name = sample(LETTERS, 10),
value = value,
size = value,
grp = rep(c("grp1", "grp2"), 5),
stringsAsFactors = FALSE
)
edges <- data.frame(
source = sample(nodes$name, 20, replace = TRUE),
target = sample(nodes$name, 20, replace = TRUE),
stringsAsFactors = FALSE
)
library(shiny)
ui <- fluidPage(
fluidRow(
column(12, echarts4rOutput("graph"))
)
)
server <- function(input, output, session) {
output$graph <- renderEcharts4r({
e_charts() |>
e_graph(
emphasis = list(focus = 'adjacency')
) |>
e_graph_nodes(nodes, name, value, size, grp) |>
e_graph_edges(edges, source, target)
})
}
shinyApp(ui, server)
Thank you for your response! However, I was looking for a way to link two graphs together and have "clicking on one graph select the corresponding nodes on the other graph".
I actually need the "behaviour" of the emphasis = list(focus = 'adjacency'), but I would like it to be controlled by an external input (clicking on the first plot).
Do you have any suggestion to do so?
Thanks! It worked
Since the plots were from the same df but with different size, I first had to reorder the tables by creating a common index scale. After that I was able to successfully plot the graphs.
Hello,
I'm currently developing a ShinyApp and I'm trying to use the Node Adjacency functions to highlight certain nodes in my network. However, the functions are not working as expected.
I've attempted to figure out the issue by copying and pasting examples from the official documentation (https://echarts4r.john-coene.com/reference/node_adjacency.html), as well as trying the other example (https://echarts4r.john-coene.com/reference/graph_action.html), but neither has worked.
I'm using R version 4.2.0 and echarts4r version 0.4.4.
Can someone please assist me in resolving this issue?