YaccConstructor / QuickGraph

Generic Graph Data Structures and Algorithms for .NET
http://yaccconstructor.github.io/QuickGraph/
Microsoft Public License
523 stars 198 forks source link

Graphviz : Export when numerical values are float #192

Closed PHPierrre closed 4 years ago

PHPierrre commented 5 years ago

Hello ! I searched for the issues in this repos and in the CodePlex archive but I haven't found a solution to this problem.

When you want to customize the size of your vertex with the FormatVertex event with a float value, you can set only integers.

Examples :

(work)

args.VertexFormatter.FixedSize = true;
args.VertexFormatter.Size = new SizeF(1f, 1f);

but this doesn't work

args.VertexFormatter.FixedSize = true;
args.VertexFormatter.Size = new SizeF(0.5f, 0.5f);

The second example generate a dot file with this :

0 [ .... fixedsize=true,  height=0,5,  width=0,5,  ....];

In cause this line convert the 0.5f in 0,5 https://github.com/YaccConstructor/QuickGraph/blob/ddedfbc8ae0b1a5be99902cbf2573dbb97074215/src/QuickGraph.Graphviz/Dot/GraphvizVertex.cs#L77

and this line set a point after : https://github.com/YaccConstructor/QuickGraph/blob/ddedfbc8ae0b1a5be99902cbf2573dbb97074215/src/QuickGraph.Graphviz/Dot/GraphvizVertex.cs#L45

Do I make a mistake while I'm coding ? Thanks,

Pierre

jnyrup commented 5 years ago

This is a localization issue. By default ToString uses the CultureInfo.CurrentCulture. If the computer you're using it set to French, QuickGraph will then use comma as decimal separator.

I've submitted a PR to fix this in #193

PHPierrre commented 5 years ago

Indeed, my operating system is in French and numbers are written with comma. Thank for your work and your PR.