d3-graphviz icon indicating copy to clipboard operation
d3-graphviz copied to clipboard

Can't render special dot string and get uncaught error in Console

Open chouzz opened this issue 1 year ago • 7 comments

Seems I can't render some dot string and there is uncaught error in Console.

  • This also happens in d3-graphivz master branch.
  • Tried this dot string in http://magjac.com/graphviz-visual-editor/ looks good.
  • Preview this dot string in vscode by vscode-graphviz, it looks good too.

Reproduce steps:

  • git clone d3-graphviz repo
  • npm install && npm run build
  • Replece following dot string to examples/basic-add-edge.html:20
digraph {graph [style="filled",fillcolor="#edf0f7",color="grey50"]
node [style="filled",fillcolor="#a2b4d6",color="#000000",fontname="Helvetica",fontsize="10",shape="polygon"]
edge [fontname="Helvetica",fontsize="10",labelfontname="Helvetica",labelfontsize="10"]
subgraph "cluster_oam_a1a9"{ id="oam_a1a9" style="filled, dashed" label="oam" "common_adfb" "lldp_07c4"subgraph "cluster_common_adfb"{ id="common_adfb" style="filled, bold" label="common" "data_thread_d165" "dwn_thread_dc59" "init_da14" "sync_thread_8499"}}"common_adfb" [id="common_adfb" label="common" tooltip="src/oam/common/"];
"init_da14" [id="init_da14" label="init" tooltip="src/oam/common/init/"];
"sync_thread_8499" [id="sync_thread_8499" label="sync_thread" tooltip="src/oam/common/sync_thread/"];
"lldp_07c4" [id="lldp_07c4" label="lldp" tooltip="src/oam/lldp/"];
"data_thread_d165" [id="data_thread_d165" label="data_thread" tooltip="src/oam/common/data_thread/"];
"dwn_thread_dc59" [id="dwn_thread_dc59" label="dwn_thread" tooltip="src/oam/common/dwn_thread/"];
"common_adfb" -> "init_da14" [id="common_adfb^init_da14" label="13" color="red"];
"common_adfb" -> "sync_thread_8499" [id="common_adfb^sync_thread_8499" label="3" color="red"];
"common_adfb" -> "lldp_07c4" [id="common_adfb^lldp_07c4" label="7" color="red"];
"common_adfb" -> "data_thread_d165" [id="common_adfb^data_thread_d165" label="4" color="red"];
"common_adfb" -> "dwn_thread_dc59" [id="common_adfb^dwn_thread_dc59" label="2" color="red"];
"init_da14" -> "common_adfb" [id="init_da14^common_adfb" label="10" color="red"];
"init_da14" -> "lldp_07c4" [id="init_da14^lldp_07c4" label="3" color="red"];
"init_da14" -> "data_thread_d165" [id="init_da14^data_thread_d165" label="1" color="red"];
"init_da14" -> "dwn_thread_dc59" [id="init_da14^dwn_thread_dc59" label="1" color="red"];
"init_da14" -> "sync_thread_8499" [id="init_da14^sync_thread_8499" label="1" color="red"];
"sync_thread_8499" -> "common_adfb" [id="sync_thread_8499^common_adfb" label="7" color="red"];
"sync_thread_8499" -> "init_da14" [id="sync_thread_8499^init_da14" label="4" color="red"];
"sync_thread_8499" -> "data_thread_d165" [id="sync_thread_8499^data_thread_d165" label="1" color="red"];
"sync_thread_8499" -> "lldp_07c4" [id="sync_thread_8499^lldp_07c4" label="1" color="red"];
"lldp_07c4" -> "common_adfb" [id="lldp_07c4^common_adfb" label="29" color="red"];
"lldp_07c4" -> "init_da14" [id="lldp_07c4^init_da14" label="21" color="red"];
"lldp_07c4" -> "sync_thread_8499" [id="lldp_07c4^sync_thread_8499" label="2" color="red"];
"lldp_07c4" -> "data_thread_d165" [id="lldp_07c4^data_thread_d165" label="5" color="red"];
"lldp_07c4" -> "dwn_thread_dc59" [id="lldp_07c4^dwn_thread_dc59" label="1" color="red"];
"data_thread_d165" -> "common_adfb" [id="data_thread_d165^common_adfb" label="2" color="red"];
"data_thread_d165" -> "init_da14" [id="data_thread_d165^init_da14" label="1" color="red"];
"data_thread_d165" -> "lldp_07c4" [id="data_thread_d165^lldp_07c4" label="2" color="red"];
"dwn_thread_dc59" -> "common_adfb" [id="dwn_thread_dc59^common_adfb" label="3" color="red"];
"dwn_thread_dc59" -> "init_da14" [id="dwn_thread_dc59^init_da14" label="1" color="red"];
"dwn_thread_dc59" -> "lldp_07c4" [id="dwn_thread_dc59^lldp_07c4" label="1" color="red"];
"dwn_thread_dc59" -> "data_thread_d165" [id="dwn_thread_dc59^data_thread_d165" label="1" color="red"];
}
  • run http-server . in command line and open basic-add-edge.html file

Actual behavior:

Get empty result and get errors in Console. empty-result

Expect beahvior:

should render graph from given dot string

Possible fixes:

Seems it's related to https://github.com/magjac/d3-graphviz/blob/64244fe5a18b05cc42353e25653093cdea9ff528/src/dot.js#L18 , the program exited in this line.

chouzz avatar Jun 16 '23 04:06 chouzz