小编Dan*_*ole的帖子

Shiny&networkD3响应节点点击

我正在尝试使用networkD3和shiny来可视化一些数据.我希望在单击图表中的节点时执行操作.我正在使用对齐网络,如下面的代码所示.

forceNetwork可以选择在单击节点时进行"clickaction"响应.但是,我无法为diagonalNetwork找到类似的选项,还有另一种方法可以实现吗?

谢谢你的帮助!

#### Load necessary packages and data ####
library(shiny)
library(networkD3)

data(MisLinks)
data(MisNodes)

hc <- hclust(dist(USArrests), "ave")
URL <- paste0(
  "https://cdn.rawgit.com/christophergandrud/networkD3/",
  "master/JSONdata//flare.json")



## Convert to list format
Flare <- jsonlite::fromJSON(URL, simplifyDataFrame = FALSE)


#### Server ####
server <- function(input, output) {

  output$simple <- renderDiagonalNetwork({
    diagonalNetwork(List = Flare, fontSize = 10, opacity = 0.9)
  })  


  output$force <- renderForceNetwork({
    forceNetwork(Links = MisLinks, Nodes = MisNodes, Source = "source",
                 Target = "target", Value = "value", NodeID = "name",
                 Group = "group", opacity …
Run Code Online (Sandbox Code Playgroud)

javascript r shiny networkd3 htmlwidgets

5
推荐指数
1
解决办法
896
查看次数

Plotly - Shape positions using subplot

I am trying to plot multiple subplots with shapes on each plot. From the following code below, if I display one plot I get the following plot: 正确显示一幅图

When I position 4 copies of this plot in a subplot I get the following: 4 个子图的显示不正确。 所有形状都绘制在同一位置

As you can see all of the 4 lines that should be drawn one on each subplot have all been drawn in the original position in the top left subplot. Any ideas how I can fix this?

** …

r shiny plotly

5
推荐指数
1
解决办法
2246
查看次数

标签 统计

r ×2

shiny ×2

htmlwidgets ×1

javascript ×1

networkd3 ×1

plotly ×1