YaccConstructor/QuickGraph

Graphviz : Export when numerical values are float

PHPierrre opened this issue · 2 comments

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

writer.Write(" {0}={1}", entry.Key, entry.Value.ToString().ToLower());

and this line set a point after :

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

Pierre

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

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