Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Edge labels not showing #18

Open
DukeyToo opened this issue Mar 25, 2023 · 3 comments
Open

Edge labels not showing #18

DukeyToo opened this issue Mar 25, 2023 · 3 comments
Labels
bug Something isn't working confirmed

Comments

@DukeyToo
Copy link

Hi, and thanks for this project, it is a great idea and implementation!

I'm trying to use the label feature, and it does not seem to do anything for me. The lines draw, but there is no label.

Looking at the code, I'm pretty sure its because main.go uses NewColoredGraph, and the label code was only added for NewBasicGraph

@nikolaydubina
Copy link
Owner

nikolaydubina commented Mar 25, 2023

hi, I think ColoredGraph is using labels.

Could you share your input JSONL file and output DOT file that jsonl-graph produces for you?

@DukeyToo DukeyToo changed the title Labels not showing Edge labels not showing Mar 25, 2023
@DukeyToo
Copy link
Author

https://github.com/nikolaydubina/jsonl-graph/blob/main/dot/color.go#L86

It does not seem to be using edge labels.

Example input:

{"from":"github.com/nikolaydubina/jsonl-graph/graph","to":"bufio","label":"hello"}
{"from":"github.com/nikolaydubina/jsonl-graph/graph","to":"bytes"}
{"from":"github.com/nikolaydubina/jsonl-graph/graph","to":"encoding/json"}
{"from":"github.com/nikolaydubina/jsonl-graph/graph","to":"errors"}
{"from":"github.com/nikolaydubina/jsonl-graph/graph","to":"fmt"}

running:

cat lines.jsonl | ~/go/bin/jsonl-graph | dot -Tsvg

and outputs (expect to see "hello" in there somewhere):

<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN"
 "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
<!-- Generated by graphviz version 2.50.0 (0)
 -->
<!-- Title: G Pages: 1 -->
<svg width="424pt" height="265pt"
 viewBox="0.00 0.00 424.00 265.00" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
<g id="graph0" class="graph" transform="scale(1 1) rotate(0) translate(4 261)">
<title>G</title>
<polygon fill="white" stroke="transparent" points="-4,4 -4,-261 420,-261 420,4 -4,4"/>
<!-- bufio -->
<g id="node1" class="node">
<title>bufio</title>
<polygon fill="#c8c8c8" fill-opacity="0.784314" stroke="transparent" points="341,-223.5 341,-252.5 385,-252.5 385,-223.5 341,-223.5"/>
<polygon fill="none" stroke="black" points="341,-223.5 341,-252.5 385,-252.5 385,-223.5 341,-223.5"/>
<text text-anchor="start" x="348.5" y="-234.3" font-family="Times,serif" font-size="14.00">bufio</text>
</g>
<!-- bytes -->
<g id="node2" class="node">
<title>bytes</title>
<polygon fill="#c8c8c8" fill-opacity="0.784314" stroke="transparent" points="341,-168.5 341,-197.5 385,-197.5 385,-168.5 341,-168.5"/>
<polygon fill="none" stroke="black" points="341,-168.5 341,-197.5 385,-197.5 385,-168.5 341,-168.5"/>
<text text-anchor="start" x="348.5" y="-179.3" font-family="Times,serif" font-size="14.00">bytes</text>
</g>
<!-- encoding/json -->
<g id="node3" class="node">
<title>encoding/json</title>
<polygon fill="#c8c8c8" fill-opacity="0.784314" stroke="transparent" points="318,-113.5 318,-142.5 408,-142.5 408,-113.5 318,-113.5"/>
<polygon fill="none" stroke="black" points="318,-113.5 318,-142.5 408,-142.5 408,-113.5 318,-113.5"/>
<text text-anchor="start" x="325" y="-124.3" font-family="Times,serif" font-size="14.00">encoding/json</text>
</g>
<!-- errors -->
<g id="node4" class="node">
<title>errors</title>
<polygon fill="#c8c8c8" fill-opacity="0.784314" stroke="transparent" points="340,-58.5 340,-87.5 386,-87.5 386,-58.5 340,-58.5"/>
<polygon fill="none" stroke="black" points="340,-58.5 340,-87.5 386,-87.5 386,-58.5 340,-58.5"/>
<text text-anchor="start" x="347" y="-69.3" font-family="Times,serif" font-size="14.00">errors</text>
</g>
<!-- fmt -->
<g id="node5" class="node">
<title>fmt</title>
<polygon fill="#c8c8c8" fill-opacity="0.784314" stroke="transparent" points="346,-3.5 346,-32.5 380,-32.5 380,-3.5 346,-3.5"/>
<polygon fill="none" stroke="black" points="346,-3.5 346,-32.5 380,-32.5 380,-3.5 346,-3.5"/>
<text text-anchor="start" x="353" y="-14.3" font-family="Times,serif" font-size="14.00">fmt</text>
</g>
<!-- github.com/nikolaydubina/jsonl&#45;graph/graph -->
<g id="node6" class="node">
<title>github.com/nikolaydubina/jsonl&#45;graph/graph</title>
<polygon fill="#c8c8c8" fill-opacity="0.784314" stroke="transparent" points="8,-113.5 8,-142.5 266,-142.5 266,-113.5 8,-113.5"/>
<polygon fill="none" stroke="black" points="8,-113.5 8,-142.5 266,-142.5 266,-113.5 8,-113.5"/>
<text text-anchor="start" x="15" y="-124.3" font-family="Times,serif" font-size="14.00">github.com/nikolaydubina/jsonl&#45;graph/graph</text>
</g>
<!-- github.com/nikolaydubina/jsonl&#45;graph/graph&#45;&gt;bufio -->
<g id="edge1" class="edge">
<title>github.com/nikolaydubina/jsonl&#45;graph/graph&#45;&gt;bufio</title>
<path fill="none" stroke="black" d="M175.75,-147.04C216.81,-167.2 282.11,-199.27 323.48,-219.58"/>
<polygon fill="black" stroke="black" points="322.17,-222.84 332.69,-224.11 325.25,-216.56 322.17,-222.84"/>
</g>
<!-- github.com/nikolaydubina/jsonl&#45;graph/graph&#45;&gt;bytes -->
<g id="edge2" class="edge">
<title>github.com/nikolaydubina/jsonl&#45;graph/graph&#45;&gt;bytes</title>
<path fill="none" stroke="black" d="M213.52,-147.04C250.27,-156.07 292.89,-166.53 323.02,-173.93"/>
<polygon fill="black" stroke="black" points="322.19,-177.33 332.73,-176.31 323.85,-170.53 322.19,-177.33"/>
</g>
<!-- github.com/nikolaydubina/jsonl&#45;graph/graph&#45;&gt;encoding/json -->
<g id="edge3" class="edge">
<title>github.com/nikolaydubina/jsonl&#45;graph/graph&#45;&gt;encoding/json</title>
<path fill="none" stroke="black" d="M274.11,-128.5C282.87,-128.5 291.43,-128.5 299.55,-128.5"/>
<polygon fill="black" stroke="black" points="299.58,-132 309.58,-128.5 299.58,-125 299.58,-132"/>
</g>
<!-- github.com/nikolaydubina/jsonl&#45;graph/graph&#45;&gt;errors -->
<g id="edge4" class="edge">
<title>github.com/nikolaydubina/jsonl&#45;graph/graph&#45;&gt;errors</title>
<path fill="none" stroke="black" d="M213.52,-109.96C249.77,-101.06 291.73,-90.75 321.78,-83.38"/>
<polygon fill="black" stroke="black" points="323.01,-86.68 331.88,-80.89 321.34,-79.88 323.01,-86.68"/>
</g>
<!-- github.com/nikolaydubina/jsonl&#45;graph/graph&#45;&gt;fmt -->
<g id="edge5" class="edge">
<title>github.com/nikolaydubina/jsonl&#45;graph/graph&#45;&gt;fmt</title>
<path fill="none" stroke="black" d="M175.75,-109.96C217.85,-89.29 285.44,-56.1 326.58,-35.89"/>
<polygon fill="black" stroke="black" points="328.25,-38.97 335.69,-31.42 325.17,-32.69 328.25,-38.97"/>
</g>
</g>
</svg>
~/graphs

@nikolaydubina
Copy link
Owner

ok, I see what you mean now.

I haven't used labels in edges. most of examples/tests are using only node labels.

But you are correct, Colored Graph seems missing label.

@DukeyToo feel free to raise PR to add. (but please commit example output or test in PR)

or else I will add later !

thanks for find !

@nikolaydubina nikolaydubina added bug Something isn't working confirmed labels Mar 25, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working confirmed
Projects
None yet
Development

No branches or pull requests

2 participants