PyFRC2G icon indicating copy to clipboard operation
PyFRC2G copied to clipboard

Suggestion: wrap long labels

Open bitbooster opened this issue 9 months ago • 1 comments

I noticed that if there is a very long alias that e.g. includes a list of a dozen network ranges (e.g. we have such an alias to track all Google Workspace networks that may be legitimate connections to smtp port 25) the graph shape gets... distorted and perhaps hard to read or print. One idea to avoid that would be to wrap long labels. I played a bit with wrapping text at 40 characters, but there might be better choices, so I'm not submitting a PR, just leaving it as an idea. It would be fairly simple to implement in Python:

$ diff graph_generator.py graph_generator.py.NEW 
14a15
> import textwrap
187c188,189
<                         sg.node(nid, label=label, shape="record", 
---
>                         wrapped = r"\n".join(textwrap.wrap(label, width=40))
>                         sg.node(nid, label=wrapped, shape="record", 

bitbooster avatar Mar 03 '26 08:03 bitbooster

Good catch! I tested it and it’s indeed much more readable. I’m incorporating your suggestion into the code. Thanks a lot.

olivierb46 avatar Mar 07 '26 07:03 olivierb46