statnet / ndtv

ndtv: Network Dynamic Temporal Visualizations in R

Home Page:https://cran.r-project.org/web/packages/ndtv/index.html

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

renderNdtvAnimationWidget() does not work if your network does not contain temporal information

Dekermanjian opened this issue · comments

renderNdtvAnimationWidget() will return a blank iFrame of the widget if you do not have any temporal information. Is there any way to render in a Shiny app a network constructed by render.d3movie() where animation output controls are disabled by default?

I have not tried inside a shiny app, but the ndtv-d3 vignette has an example of rendering a static network that can still be interacted with in the browser without the timeline controls:

data(emon)
totalStaff<-emon[[5]]%v%'Volunteer.Staff'+emon[[5]]%v%'Paid.Staff'
sizeScale<-ifelse(is.na(totalStaff),1,totalStaff/100+1)
render.d3movie(emon[[5]],
    vertex.tooltip=paste("<strong>",emon[[5]]%v%'vertex.names',"</strong><br>",
      "Decision Rank Score:",emon[[5]]%v%'Decision.Rank.Score',"<br>",
      "Command Rank Score:",emon[[5]]%v%'Command.Rank.Score',"<br>",
      "Formalization:",emon[[5]]%v%'Formalization',"<br>",
      "Location:",emon[[5]]%v%'Location',"<br>",
      "Sponsorship:",emon[[5]]%v%'Sponsorship',"<br>"),
    vertex.cex=sizeScale,
    vertex.col=grDevices::adjustcolor(as.color(emon[[5]]%v%'Sponsorship'),alpha.f=0.5),
    edge.tooltip=paste('Frequency:',emon[[5]]%e%'Frequency'),
    edge.lwd='Frequency',
    edge.col='#00000055',
    )

It does seem like the html vignette intended to illustrate this functionality is not displaying correctly in the package, but you should be able to download and view in browser from https://github.com/statnet/ndtv/blob/master/ndtv_d3_vignette/ndtv-d3_vignette.html