statnet / ndtv

ndtv: Network Dynamic Temporal Visualizations in R
https://cran.r-project.org/web/packages/ndtv/index.html
49 stars 5 forks source link

vertex.spells data raising "sliceRenderData.node[item[direction][0]] is undefined" (render.d3movie) #54

Open cboulanger opened 11 months ago

cboulanger commented 11 months ago

A particular type of vertex.spells data leads to the "sliceRenderData.node[item[direction][0]] is undefined (line 1285)" error in the browser.

The data in vertex_spells_no_error.csv, which has onsets and termini for each individual year, works fine. The dataset in vertex_spells_error.csv has the min(onset) and max(terminus) for each of the vertex_ids in the first dataset. The aim is to reduce the number of spells and to provide a less "jumpy" visualization. I do not understand why dataset 1 works and dataset 2 does not.

The code for generating the network is here.

cboulanger commented 11 months ago

Ok, it seems like there needs to be an exact match of the length of the edge and vertex spells. When I try to aggregate subsequent vertex spells into one, whereas there are intermittent edge spells, the spell durations do no longer line up and this throws off the d3 rendering. I found this out by running network.dynamic.check(dynNet, verbose = TRUE, complete = TRUE) when it told me that there were active edges in the network for non-active vertices.

Maybe it would make sense to implicitly run the check when generating the d3movie and warning the user.

skyebend commented 11 months ago

there is also a reconcile.activity function that can extend or shorten vertex or edge spells to bring them into alignment