Git Product home page Git Product logo

visnetwork's Introduction

CRAN Status Badge CRAN Downloads Badge

visNetwork

R package, using vis.js library for network visualization. visNetwork is now available on CRAN.

Online documentation

And have a look to multiple R examples, vis.js documentation (visDocumentation).

News

2.1.0 available on CRAN (in a few days...)

  • #361 : fix visHclust with new ggraph version

  • switch to vis-network 9.1.0

  • visTree : fix using invalid R colnames + crash no one X

  • add fontawesome 5.13.0 support

  • #377 : custom manipulation columns

  • #335 : Enable highlightNearest degree for groups

  • visTree : update performance compute boxplot sparkline with large data

  • visTree/TreeModule : fix passing constant variable & character tooltipColumns

alt text

Example

install.packages("visNetwork")

# devtools::install_github("datastorm-open/visNetwork") for development version

require(visNetwork)
?visNetwork

# minimal example
nodes <- data.frame(id = 1:3)
edges <- data.frame(from = c(1,2), to = c(1,3))
visNetwork(nodes, edges)

# vignette
vignette("Introduction-to-visNetwork")

# full javascript documentation
visDocumentation()

# shiny example
shiny::runApp(system.file("shiny", package = "visNetwork"))

visnetwork's People

Contributors

abicky avatar bthieurmel avatar datastrategist avatar dseynaev avatar mattgrogan avatar rekyt avatar zhiboz avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

visnetwork's Issues

[Enhancement] selectedBy() with overlapping groups

Thanks for this excellent package! The title is pretty much self-explanatory. I am trying to find a way to use selectedBy() when nodes can belong to more than one group. This occurs oftentimes in practice with hierarchical decomposition of graphs (e.g., k-core decomposition). However, currently, it seems that nodes can only belong to one group.

Use information from the nodes data set to set up legend colors

Minimal reproducible example:

gg = erdos.renyi.game(6,3,type="gnm")
V(gg)$id = 1:6
V(gg)$group = c(1,1,2,2,3,3)
palette = gray.colors(n=3)
V(gg)$color = c(rep(palette[1],2),rep(palette[2],2),rep(palette[3],2))
gg_data_frame = get.data.frame(gg, what="both")
visNetwork(gg_data_frame$vertices, gg_data_frame$edges)  %>% visLegend()

Issue: the legend colors are unrelated to the colors used in the graph.

When there are many groups or when executing a dynamic script, it is not always easy or possible to manually add a single visGroups statement indicating the color that should be used for each group. Furthermore, this information is already available in the nodes data frame:

> gg_data_frame$vertices
  id group   color
1  1     1 #4D4D4D
2  2     1 #4D4D4D
3  3     2 #AEAEAE
4  4     2 #AEAEAE
5  5     3 #E6E6E6
6  6     3 #E6E6E6

So that would be nice if the legend colors could match by default the colors assigned to the groups in the nodes data frame.

worldcup 2014: issues with shiny and with large graphs

first of all many thanks for this great package!

I've tried to replicate the amazing world cup example on visjs.org.

I downloaded the same database and I tried to copy most of the same settings used by them, then I've used shiny to be able to show this on a webpage.
These are the problems I've encountered.

  • it seems as if the viz alters shiny behaviour a bit: the presence of a headerPanel with title prevents the rendering to happen.
  • if you un-comment the line with headerPanel("Worldcup 2014"), you don't get the graph, but it does not seem a problem for other htmlwidgets.
  • the rendering while still impressive, it is not as fast as the original
  • the rendering appears to be pulsating and less smooth than the original
  • the barnesHut solver seems to divide the viz in 4 parts, which does not happen with the original
  • the tooltip happens only randomly (on my apple mac)

The code and the data are available here, but for completeness I reproduce the code here (please note that in the end I filtered out all the teams that did not reach the last 16).

#------------------------------------------------------------------------------

rm(list=ls()) 
#source("./global.R",local= FALSE, echo=FALSE)
library(visNetwork)
library(jsonlite)
library(shiny)
#------------------------------------------------------------------------------

jay <- fromJSON(txt= "./data/worldcup2014-.json")
edges <- jay[["edges"]]
nodes <- jay[["nodes"]]
# nodes <- nodes[nodes$Country=="Italy",]

nodes$x <- nodes$y <- nodes$group <- nodes$value <- NULL
colnames(nodes) <- c("id", "label","group","title")
# nodes$label <- nodes$title <- NULL
nodes$title <- paste0("<p><b>", nodes$label,"</b><br>",nodes$group, " - ", nodes$title,"</p>")
sixteen <- c("Brazil",
             "Chile",
             "Colombia",
             "Uruguay",
             "France",
             "Nigeria",
             "Germany",
             "Algeria",
             "Netherlands",
             "Mexico",
             "Costa Rica",
             "Greece",
             "Argentina",
             "Switzerland",
             "Belgium",
             "United States")
# nodes <- nodes[nodes$group %in% sixteen,]
#------------------------------------------------------------------------------

ui = fluidPage(

  #  headerPanel("Worldcup 2014"), 
    tabPanel("panel",visNetworkOutput("mynetwork",width="100%", height="700px") ) 
)

server = function(input, output) {
output$mynetwork <- renderVisNetwork({
visNetwork(nodes, edges) %>% visLayout(improvedLayout = TRUE, hierarchical = FALSE) %>%
   # visPhysics(solver="forceAtlas2Based",forceAtlas2Based=list(gravitationalConstant=-500000,centralGravity =0.001)) %>%
visPhysics(solver="barnesHut", barnesHut=list(gravitationalConstant= -80000, springConstant= 0.001,
 springLength= 200), stabilization= FALSE ) %>%
 visInteraction(   tooltipDelay= 10, hideEdgesOnDrag= TRUE) %>%
    visNodes(shape="dot")
})
}

shinyApp(ui=ui, server=server)

[Enhancement] More features in selectedBy | Nodeselection

Hi,

Firstly, thanks for the quick implementation on default values.
I'm wondering can the dropdown list be further customized?

  1. filter some unwanted nodes, there's a huge amount of nodes but I only want user to choose from a given list. for example, nodes ends with '_FG$' this will help remove the noises
  2. able to sort the drop down list option items
  3. make the width of drop down configurable OR wider to accommodate long character string

Thanks

visNetwork() does not display in Jupyter

When attempting to use visNetwork with Jupyter, the display does not render, nor does it error. I've attached a screenshot of a notebook and can include the notebook by email if needed
screen shot 2015-11-19 at 11 41 39 am
.

How to customize elements like background, border, and opacity for individual nodes/edges?

Hello, first I want to say thank you for creating such an innovative package for visualizing networks! For some of my graphs I'd like to have some nodes have different background colors than others, and also be able to customize other aspects like the border. Same concept for edges: I'd like to set for example the opacity of one edge to be smaller than others. When I define the data frame with node information, it's easy to set the color for the node as a separate column, but when I try to add the individual attributes like background and border, there is no effect when I render the graph. I know that the documentation for visNodes says to supply a named list containing the desired values for say background and border, but as far as I can tell this applies the settings to all nodes. Is there a way to specify these types of attributes on a per-node basis? Here's some example code I tried. I'm running the latest version from CRAN.

library(visNetwork)
library(magrittr)

nodes <- data.frame(id = paste0("node", 1:5),
                    label = paste0("node", 1:5),
                    shape = "box",
                    background = c("green", "yellow", "yellow", "red", "red"),
                    border = "black")

edges <- data.frame(
  from = c("node1", "node2", "node2", "node3", "node4", "node5"),
  to = c("node2", "node3", "node5", "node4", "node5", "node4"),
  label = paste0("edge", 1:6),
  length = 400,
  smooth = TRUE,
  color = c("red", "blue", "blue", "blue", "blue", "blue"),
  opacity = c(0.1, 0.1, 1, 1, 1, 1))

visNetwork(nodes, edges) %>%
  visEdges(arrows = "to", font = list(background = "white", size = 16)) %>%
  visLayout(randomSeed = 7, hierarchical = FALSE, improvedLayout = TRUE)

Prevent node overlap when using "Hierarchical Layout"?

First I would like to state that I am enjoying experimenting with this package. I am working through every R package for network visualization that I can find in an attempt to find the best one for plotting directed acyclic graphs (DAG's). This is the best one I have encountered thus far.

Is there a way (i.e. a parameter to set) which will prevent nodes from contacting and/or overlapping each other when using visHierarchicalLayout()? I see that there is a nodeOverlap parameter in visPhysics() but it does not appear to be available for hierarchicalRepulsion.

[Enhancement] Multiline textfield for addNode / editNode popUp

The pop-up window for editing or adding nodes in a graph should provide a multiline input window for entering the "label" text. The reason is to provide the possibility to input bigger (markdown) text if required.
In addition, configuring this popup window by visOption would be nice (text in the window, size ...)

[improvement idea] Temporal Network Capability?

Here's my use case (in supply chain):
Parts move from different place/stages in a weekly manner.
I used quarterly data (distinct edge relationship) to build the skeleton of the network.
Then at particular week fill in different color on the edge to indicate weekly volumn data (some edge might be none, which should be transparent)
However, the issue is if I update with a new dataset, the diagram will redraw and the position of node become random.

Is there a way to include a version component and able to 'play' the network while keeping all nodes/edges in their original position?

Slow loading for dense graph

I have a very dense, weighted-edges graph (~600 edges, 40 nodes) that takes about 20 seconds to load. It's not stabilization that's slow, nothing appears in that time. Any ideas for how to speed it up? Here's my code:

visNetwork(dfs$vertices, dfs$edges) %>%
    visEdges(arrows = 'to',
             color = list(opacity = .3, highlight = 'black'))  %>%
    visNodes(shape = "square",
             color = list(border  = 'black'),
             font = list(size = 28),
             shadow = TRUE) %>%
    visOptions(highlightNearest = TRUE
               , nodesIdSelection = TRUE) %>%
    visPhysics(maxVelocity = 500
               , solver = 'barnesHut'
               , barnesHut = list(gravitationalConstant = -5e3, damping = .6)
    )

Nodes belongs to multiple groups

Hi,
I am trying to set network with nodes that can be part of multiple groups, or create subgroups.
I used visGroups
Not working...
Any suggestions?
Thanks

nodes <- data.frame(id = 1:10, 
                    label = paste("Node", 1:10),
                    value = c(10,5,3,7,2,3,2.6,2,9,2),
                    shape ="circle",
                    group= c("Gr1","Gr3")
                    )   

edges <- data.frame(from = sample(1:10,8), to = sample(1:10, 8)) 

graph <- visNetwork(nodes, edges, width = "150%")
visNetwork(nodes, edges, width = "150%") 
 visNodes(graph, scaling = list(label = list(enabled = TRUE)), group= list(group = list(enabled= TRUE)))
  visGroups(graph, useDefaultGroups = TRUE, groupname = c("BB1","BB3"))
   visOptions(graph,manipulation = TRUE, selectedBy = "group")

arrowhead =c("diamond","tee","tee","curve")

Hi,
It is possible to change the style of the arrowhead?

edges <- data.frame(from = sample(1:10,8),
                    to = sample(1:10, 8),
                    label = paste("Edge", 1:8),                                 # add labels on edges
                    length = c(100,500),                                        # length
                    arrows = c("to", "from", "middle", "middle;to"),            # arrows
                    arrowhead =c("diamond","tee","tee","curve"),
                    dashes = c(TRUE, FALSE),                                    # dashes
                    title = paste("Edge", 1:8),                                 # tooltip (html or character)
                    smooth = c(FALSE, TRUE),                                    # smooth
                    shadow = c(FALSE, TRUE, FALSE, TRUE)) 

Thanks
Karim

dynamic network

Hi.
Thanks for the great package !
I'm using shiny and i was asking if it is possible to build dynamic network "programmatically"

  • i mean as the user can edit the network for example, would it be possible to do the same, but based on some "script" send by the server file ?
  • idea is to see "clips" of network dynamic : nodes coloring one after the other (to see flow of information), network growing in size, ...

Thanks in advance for the support !

Regards,

Pierre

optionally add bootstrap?

I understand why you would include Bootstrap to offer an opinionated way of insuring the output looks nice, but it is quite heavy especially when doing standalone without the benefit of a CDN. Also, Bootstrap is not namespaced well, so I have had quite a few conflicts with things such as tooltips when using multiple js libraries. Would it be better to optionally add/remove Bootstrap?

For reference, I did something like this to add the dependency for FontAwesome.

Another way I have achieved Bootstrap is leveraging shiny.tags, since Shiny has Bootstrap.

graph redraws for every click when nodes have coordinates, highlightNearest==TRUE and randomSeed is used

Reproducible example:

nodes = data.frame(id=1:10,group=c(rep(1,5),rep(2,5)))
# assign coordinates
nodes[c("x","y")] = layout_nicely(g)*100
edges = data.frame(from=sample(1:10,20,replace=TRUE),to=sample(1:10,20,replace=TRUE))
visNetwork(nodes, edges) %>% visOptions(selectedBy = "group", highlightNearest = TRUE) %>% visLayout(randomSeed = 1234)

Clicking on a node (or anywhere on or outside the graph), or selecting a group from the dropdown redraws the graph from scratch (which creates of lot of instability!). The problem is solved when removing visLayout(randomSeed = 1234), but in some cases it might be needed to set seed.

Geographic coordinates and map overlay

Dear developers,

First, thank you for this great package.

I want to plot 2D graphs using geographic coordinates for the nodes. I think that this is possible with visNetwork. However, I don't see a way I could use a georreferenced map as background. Is there any option I could use (vis or html)?

As for example, take a look at this similar question on the iGraph package:

Thank you in advance for your attention.

Beni.

how to set different width for each edge?

great network visualization tool! just wonder if it is possible to set different width for each edge; looked through the doc but was only able to set a global edge width.

[Enhancement] ways to decrease plotting speed

It takes very long (about one minute both on shinyapps.io and RStudio on my laptop) to plot a graph with only 140 nodes/250 edges, and my browser freezes/almost collapses. Is that normal? What are ways to optimize performance?

Note: I know that hideEdgesOnDrag and hideNodesOnDrag can help once the graph is plotted, but here my problem deals with the time required to plot the graph initially.

Thanks in advance for your advice

enhancement: animate nodes into new position

Hi,

I was wondering, with the current api of vis.js, would it be possible to animate a set of nodes into a new position, in which the user can specify the final x and y coordinates? I know in vis.js one can explicitly provide x and y coordinates, however, I didn't see a way to animate the transition from old to new.

Given the fact that nodes and edges can be made to move based on tick events and the fact that there is a animated 'fit network to screen dimensions' I think it would be possible. However, I couldn't find out to do this. Then again, perhaps it's just not possible.

http://stackoverflow.com/questions/32902720/vis-js-place-node-manually

http://stackoverflow.com/questions/31159422/vis-js-fit-a-set-of-nodes-on-screen

kind regards, Herman

visIgraphLayout overrides visLayout(randomSeed = 1)

The newly updated visIgraphLayout option is impressively fast - visNetwork is now an unrivalled package!

However, I cannot now fix the layout seed. As a MWE I've taken the example from the visIgraphLayout documentation page:

nnodes <- 200
nnedges <- 400
nodes <- data.frame(id = 1:nnodes)
edges <- data.frame(from = sample(1:nnodes, nnedges, replace = T),
                    to = sample(1:nnodes, nnedges, replace = T))
visNetwork(nodes, edges) %>%
  visLayout(randomSeed = 1) %>%
  visIgraphLayout() %>%
  visNodes(size = 10)

Missing legend for latest Dev version.

The following code didn't work - not able to see the legend. Nor my own data worked.
set.seed(123)
nodes <- data.frame(id = 1:10, color = c(rep("blue", 6), rep("red", 3), rep("green", 1)))
edges <- data.frame(from = round(runif(6)_10), to = round(runif(6)_10))
visNetwork(nodes, edges, legend = TRUE)

untitled

Add support for basic R color palettes

Minimal reproducible example:

gg = erdos.renyi.game(6,3,type="gnm")
V(gg)$id = 1:6
V(gg)$color = gray.colors(n=6)
gg_data_frame = get.data.frame(gg, what="both")
visNetwork(gg_data_frame$vertices, gg_data_frame$edges)

The colors render well for gray.colors, but not for any other standard R color palettes: rainbow, heat.colors, etc (in these cases the nodes all show up as black).

Specify variable node background colour and the border colour

I would like to be able to vary the background colour of the nodes in my graph but use a border colour to ensure nicely delimitated nodes compared to edges.

I thought that the following should work, but it does not:

nodes <- data.frame(id = 1:3,
                    color = c("lightblue","red","blue"))
edges <- data.frame(from = c(1,2), to = c(1,3))
visNetwork(nodes, edges) %>% visNodes(color = list(border = "black"))

image

I tried providing a vector of colors directly to visNodes without success, indeed the colors are retained from the data.frame column color

visNetwork(nodes, edges) %>% visNodes(color = list(background = c("yellow","pink","blue"), 
border = "black"))

image

visNetwork is a great package but is under queried on SE, I ask this question here in the Issues rather than SE because of that. I would like to take your feedback from here and post a self-answered question on SE to guide people there, if ok with you.

feature request: allow network to be controlled via a proxy object

Hi,

would it be possible to add functionality to update an already existing network, without re-rendering it?

For instance, in leaflet you can modify an already existing map via a proxy object, see here.

I've already implemented it, as in a previous version of visNetwork this feature was missing (to my knowledge). I'm not very familiar with your code but I implemented my own binding of vis.js as follows:

Assume you generate a network via a render call in server under the id: mynetwork and let's say I want to change the physics properties and set the focus of the network to a given node in the network, in which the viewer zooms in a puts that node in the center of the page. However, we don't want to re-render the network each time, we just want to update an existing network.

So I want to do something like this:

  1. Create a network via an appropriate render function called in server.r
  2. Setup input controls that allow you to change the physics properties of the network via some input controls defined in ui.r
  3. Change the focus of the network to some node id controlled via some input controller defined in ui.r.
  4. Update the network when you change the input controls, however, without re-rendering the whole network.
  5. send custom messages from Shiny to update the network (via ''sendCustomMessage').

The idea is to store the network in a jQuery variable called state inside the div in which the network is rendered.

Auxiliary functions other than the main render network function in server.r can get to this data via the id and can then retrieve the network to make changes to it.

Here are some code snippets:

Create a render function to generate an initial network:

 output$mynetwork <- renderNetwork({

    # get some data
    nodes = ...
    edges = ...

    # prep data
    data    = list(nodes=nodes,edges=edges)

    # chart options
    options = list()

    # combine into list
    L <- list(data = data, options = options)

   # send list to javascript
    return(L)
  })

renderNetwork is just a simple vanilla output binding to vis.js in which I pass a data object holding node and edge info and an options list, containing network options I want to set initially.

Next setup some observers in server which listen to the input controller which manipulate the network:

server.r code to change the physics properties

  observe({
    data <- list(
      id                    = "mynetwork1",
      gravitationalConstant = input$gravitationalConstant,
      centralGravity        = input$centralGravity,
      springLength          = input$springLength,
      springConstant        = input$springConstant,
      damping               = input$damping,
      avoidOverlap          = input$avoidOverlap
    )

    session$sendCustomMessage("physicsOptions",data)
  })

server code to change the focus

  observe({
    data <- list(id = "mynetwork", focusId = input$FocusId)
    session$sendCustomMessage("Focus",data)
  })

I implemented the binding as an 'old school' custom output binding, instead of your newer HTMLWidget style. For initial rendering of the network you would have a 'renderValue'. In the code snippet el is the element passed from Shiny in which we want to render the network and L is the data object, which holds the node/edge data and the options for the network.

binding.renderValue = function(el,L) {

  // get element
  var $el = $(el);

  // store the result on $el as a data value called "state".
  if (!$el.data("state")){

    // create an array with nodes
    var nodes = new vis.DataSet(L.data.nodes);

    // create an array with edges
    var edges = new vis.DataSet(L.data.edges);

    // create data object
    var data = {
      nodes: nodes,
      edges: edges
    };

    // determine chart id send by Shiny
    var ChartID   = el.id;

    // get container element to hold chart
    var container = document.getElementById(ChartID);

    // some code here to setup the network e.g via the options
    ...
    ...
    ...

    // create a network
    var network = new vis.Network(container, data, options);

    // now we have a chart
    // store the chart object on el so we can get it next time
    $el.data("state", {
      network: network,
      nodes: nodes,
      edges: edges
    });
  }

  // get previously constucted network
  var network = $el.data("state").chart;

  // code here to change the network after you rendered it 
  // but still change it via the main render network function
  ...
  ...
  ...

};

Next, outside of the main render function I added functions that via a data object passed from Shiny, (which contain an id and some data you need to change the network), can get access to the already rendered network, fetch it and manipulate it:

// Custom handler to update physicsOptions
Shiny.addCustomMessageHandler('physicsOptions', function(data){

    // get container id
    var el = $("#"+data.id);

    // get nodes object
    var network = el.data("state").chart;

    // these are all options in full.
    var options = {
      physics:{
        enabled: true,
        barnesHut: {
          gravitationalConstant: data.gravitationalConstant,
          centralGravity: data.centralGravity,
          springLength: data.springLength,
          springConstant: data.springConstant,
          damping: data.damping,
          avoidOverlap: data.avoidOverlap
        },
        solver: 'barnesHut'
      }
    };

    network.setOptions(options);

});

// focus on a node in the network
Shiny.addCustomMessageHandler('Focus', function(data){

    // get container id
    var el = $("#"+data.id);

    // get nodes object
    var network = el.data("state").chart;

        var options = {scale: 2,animation: {duration: 1500, easingFunction: "easeInOutQuad"} };

        network.focus(data.focusId,options);
});

With this type of code you can manipulate the network very easily after it was constructed, without re-rendering the network each time (which moves nodes to different places etc.).

Perhaps the current binding of visNetwork can already do this? Obviously my code doesn't you well with your code base, so there will be many differences implementing it. Anyway, I thought I share this idea with you.

kind regards, Herman

ps: this type of functionality comes in handy when you have a large graph/network and you want to explore it, instead of changing the underlying network data.

How to send back graph changes done in manipulation mode

If the graph is manipulated via manipulation mode (vis.js level), nodes added or deleted or node data changed, how can these changes send back to R level such that nodes and edges data frames contain this changes ? I changed some graphs graphically, but the node and edges data frames keep always unchanged.

[question] Can someone explain the degree option in highlightNearest function?

Hi,

I tried to put different values in degree parameter and the highlighted nodes seems to be the same. Can you explain how it works? and if possible please provide a minimal example on how to utilize it.
Also, will the degree be directional? meaning highlight the parent nodes or child nodes only? This could help when we need to trace some flow.

Thanks

How to assign nodes to a new group without redrawing the whole network?

Hi, it's a great package! I have a large network, which I am partitioning into multiple groups. Is there a way to assign the nodes to a new group without redrawing the network? or, is there a way to re-colour the nodes based on the new group? See the minimal example below:

nodes <- data.frame(id = 1:5, group=c(1,1,1,2,2))
edges <- data.frame(from = c(1,2,2,3,3,4), to = c(1,3,4,5,1,3))

network <- visNetwork(nodes, edges)

new_group = c(1,2,2,3,3)
network <- visNodes(network, group=new_group) # or use color=new_group ?

network # the resulting graph doesn't reflect the 'new_group' arrangement

I would like to embed this solution into my shiny app, perhaps using visNetworkProxy.
I thought of creating a matrix binding all group vectors together, where each column = a group vector. Then using a sliderInput in shiny to select a column index for each group vector:

visNetworkProxy("network") %>% visNodes(group = matrix[,input$matrix_index])

Hopefully this would re-colour the nodes and the legend based on the new group arrangement (without redrawing the whole network).

Any suggestions would be much appreciated!

Nodes size: value argument does not work when shape argument is used

Hi,
When I attribute shape to the nodes, I can't attribute size for nodes using value argument?
Just use this example with and without shape.
Any suggestion?
Thank

nodes <- data.frame(id = 1:10, 
                    label = paste("Node", 1:10),                                 # add labels on nodes
                    group = c("GrA", "GrB"),                                     # add groups on nodes 
                    value = c(10,5,3,7,2,3,2.6,2,9,2),
                    #shape =("circle"),
                    color = c("darkred", "grey", "orange", "darkblue", "purple"),# color
                    shadow = c(FALSE, TRUE, FALSE, TRUE, TRUE)
                    )   

edges <- data.frame(from = sample(1:10,8),
                    to = sample(1:10, 8),
                    #label = paste("Edge", 1:8),                                 # add labels on edges
                    #length = c(100,500),                                        # length
                    arrows = c("to;from", "from","none" ,"middle"),            # arrows
                    color = c("green","green","green","green"),
                    #arrowhead =c("diamond","tee","tee","curve"),
                    dashes = c(TRUE, FALSE,TRUE,TRUE),                                    # dashes
                    width = c(0.61,1,0.61,1),
                    title = paste("Edge", 1:8),                                 # tooltip (html or character)
                    smooth = c(FALSE, TRUE),                                    # smooth
                    shadow = c(FALSE, TRUE, FALSE, TRUE)
                    ) 


visNetwork::visNetwork(nodes, edges, width = "150%")

Selectby Edge

Is there any way to use the "select by" property considering an attribute of the edge?

visHierarchicalLayout performance

Hi ,

Example as below is working OK at R preview and WebBrowser:

nodes <- data.frame(id = 1:500)
edges <- data.frame(from = c(1,2), to = c(1,3))
visNetwork(nodes, edges)
network <-  visNetwork(nodes, edges)
htmlwidgets::saveWidget(network, "network.html")

when I am trying visHierarchicalLayout it is working in R preview but hungs with WebBrowser.

nodes <- data.frame(id = 1:500)
edges <- data.frame(from = c(1,2), to = c(1,3))
network <- visNetwork(nodes, edges, width = "100%") %>% visEdges(style = "arrow") %>%  visHierarchicalLayout(layout = "direction")
htmlwidgets::saveWidget(network, "network.html")

Firefox Java Console log shows (chrome and safari has similar issue):
screen shot 2015-05-04 at 12 14 06 am

plans for release

You have done a really nice job with this package. I'd like to feature it on my site http://buildingwidgets.com, but I don't want to jump the gun. I had assumed since you posted to your blog that you consider it ready for public consumption. I just wanted to verify before writing it up.

Again, well done with this.

selectedBy does not work in development version

I have recently installed the most recent version of the package (devtools::install_github("dataknowledge/visNetwork")) to benefit from the numerous recent improvements and I noticed that now selectedBy greys out all nodes (even the ones that are supposed to stay). Minimal reproducible example:

nodes = data.frame(id=1:10,group=c(rep(1,5),rep(2,5)))
edges = data.frame(from=sample(1:10,20,replace=TRUE),to=sample(1:10,20,replace=TRUE))
visNetwork(nodes, edges) %>% visOptions(selectedBy = "group", highlightNearest = TRUE)

start tagging releases

Just a suggestion, so feel free to ignore. Something I have found very helpful as I iterate through htmlwidgets on Github is to tag releases as demonstrated in this article. These releases are then available through devtools::install_github(), so this mechanism easily allows users to target a release.

set up initial zooming level

Would it be possible to initially render the network from a high zoom level (where edge and node labels are not visible)? For large networks for which stabilization takes time and is not very smooth, this would allow to converge faster (it is much smoother when labels are not visible) while still enabling the user to see the overall structure of the network. Also large networks tend to spread out a lot, so the user has to zoom out at some point to continue seeing the entire network. Starting at a higher zoom level would also take care of this. I looked at the documentation but I can't find such a parameter...

performance on larger networks

Hi,

thanks for a great package! great work!

the visjs.org website has a performance example (see http://visjs.org/examples/network/exampleApplications/worldCupPerformance.html) showing a relatively large network, which renders just fine.

When running experiments in Shiny with a matrix of 1000 nodes and 1000 edges the performance unfortunately becomes quite slow, even in chrome with a CORE i7 processor. Is there any known reason for this? Could it have to do with the fact that visjs.org currently offers version 4.0, while your current shiny implementation is based on version 3.12.0?

kind regards, Herman

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.