microsoft / automatic-graph-layout

A set of tools for graph layout and viewing
Other
1.35k stars 304 forks source link

[QUESTION] node with multi-line text #270

Closed aPlacuzzi closed 3 years ago

aPlacuzzi commented 3 years ago

Hi all,

Is it possible to put the text inside a node in multiple lines?

Example: the node text is "foo bar" and I want to visualize it like this: "foo bar"

levnach commented 3 years ago

I think "foo\nbar" is going to work

aPlacuzzi commented 3 years ago

I have tried modifying your sample MinWpfApp. Wpf view renders it correctly, as you can see here: MinWpfApp-screenshot

But if try to export the graph as svg image, I get this result: MinWpfApp-export

To export the graph as svg image I have added this code at the end of the sample:

var gr = new GraphRenderer(graph);
gr.CalculateLayout();
SvgGraphWriter.Write(graph, path, null, null, 11);

Here the svg file exported: MinWpfApp-export.svg.txt

Any ideas for the different behaviour?

levnach commented 3 years ago

@aPlacuzzi!

Obviously, there are at least two bugs there. One us not preserving the end of the line in a label , and another not keeping the octagon shape. It is open source; why don't you try to fix them?

aPlacuzzi commented 3 years ago

@levnach Ok, I should have found the two bugs. I'll try to fix them, then I'll open a PR.