JohnCoene / sigmajs

Σ sigma.js for R
http://sigmajs.john-coene.com
Other
72 stars 7 forks source link

`sg_noverlap()` shows graph only after resize #16

Open sgrubsmyon opened 3 years ago

sgrubsmyon commented 3 years ago

Running the example from ?sg_noverlap:

nodes <- sg_make_nodes(500)
edges <- sg_make_edges(nodes)

sigmajs() %>%
  sg_nodes(nodes, id, size, color) %>%
  sg_edges(edges, id, source, target) %>%
  sg_layout() %>% 
  sg_noverlap()

I see a blank page. However, if I resize the page/canvas container/browser window, the graph is rendered. Tested this in RStudio 1.3.1093, Firefox 83.0, and Chromium 87.0.4280.67. The behavior is always the same.

This is sigmajs version 0.1.5 installed from CRAN.

In the browser DevTools, I see the following console message: (/tmp/sg_noverlap.html is the file with the sigmajs htmlwidget exported with RStudio)

Uncaught TypeError: p[d.id] is undefined
    atomicGo file:///tmp/sg_noverlap.html:913
    go file:///tmp/sg_noverlap.html:913
    start file:///tmp/sg_noverlap.html:913
    startNoverlap file:///tmp/sg_noverlap.html:913
    renderValue file:///tmp/sg_noverlap.html:1142
    renderValue file:///tmp/sg_noverlap.html:891
    staticRender file:///tmp/sg_noverlap.html:658
    forEach file:///tmp/sg_noverlap.html:60
    staticRender file:///tmp/sg_noverlap.html:581
    forEach file:///tmp/sg_noverlap.html:60
    staticRender file:///tmp/sg_noverlap.html:579
    maybeStaticRenderLater file:///tmp/sg_noverlap.html:703
    <anonymous> file:///tmp/sg_noverlap.html:710
    EventListener.handleEvent* file:///tmp/sg_noverlap.html:708
    <anonymous> file:///tmp/sg_noverlap.html:907
sg_noverlap.html:913:2006
    atomicGo file:///tmp/sg_noverlap.html:913
    go file:///tmp/sg_noverlap.html:913
    start file:///tmp/sg_noverlap.html:913
    startNoverlap file:///tmp/sg_noverlap.html:913
    renderValue file:///tmp/sg_noverlap.html:1142
    renderValue file:///tmp/sg_noverlap.html:891
    staticRender file:///tmp/sg_noverlap.html:658
    forEach self-hosted:206
    forEach file:///tmp/sg_noverlap.html:60
    staticRender file:///tmp/sg_noverlap.html:581
    forEach self-hosted:206
    forEach file:///tmp/sg_noverlap.html:60
    staticRender file:///tmp/sg_noverlap.html:579
    maybeStaticRenderLater file:///tmp/sg_noverlap.html:703
    <anonymous> file:///tmp/sg_noverlap.html:710
    (Async: EventListener.handleEvent)
    <anonymous> file:///tmp/sg_noverlap.html:708
    <anonymous> file:///tmp/sg_noverlap.html:907
JohnCoene commented 3 years ago

Strange, that looks like it's in the core noverlap plugin, I might have to update that. I'll investigate this weekend.