ndtv icon indicating copy to clipboard operation
ndtv copied to clipboard

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

Open cboulanger opened this issue 1 year ago • 2 comments

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 avatar Oct 20 '23 14:10 cboulanger

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.

cboulanger avatar Oct 22 '23 16:10 cboulanger

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

skyebend avatar Oct 22 '23 21:10 skyebend