Dynamic Pen Width


#1

Walter,
I am looking for some information and thoughts on the pen width within a diagram. I am creating a graph with about 12000 nodes based on family tree example. The nodes each have only 1 parent and can have 0-1-N Children.
The graph is very flat overall. Utilizing the control on a small set of data everything looks great!, However when I am testing on the entire set I run into troubles.
Any tips or tricks for dealing with large number of nodes.
My problems are as follows, since the graph is very horizontal, and i zoom to fit, I get a line of 12000 node across the top of the screen that looks like my LCD failed. I add increase my vertical distance and the graph looks a little better, at least it uses more screen real estate. But then when i zoom in the nodes are seperated to far apart.
I am looking at a couple of areas.
Specifically, looking to have the penwidth, nodes, and seperation be the dynamically resize when zooming. I have tried some examples but I needed to relayout my graph and it was time consuming.
Maybe I am looking at this wrong.
Should i be looking into overriding the doc scale property when setting the zoom somehow?


#2
I don't understand exactly what you are looking for. But I did some experimenting, and found that you can avoid that solid black mass of links by using different transparencies in your pens.

GoBasicNode root = new GoBasicNode();

root.Location = new PointF(100, 100);

doc.Add(root);

Pen linkpen = new Pen(Color.FromArgb(9, Color.Black), 0.01f);

Pen linkpen2 = new Pen(Color.FromArgb(31, Color.Black), 0.01f);

Pen linkpen3 = new Pen(Color.FromArgb(63, Color.Black), 0.1f);

Pen linkpen4 = new Pen(Color.FromArgb(127, Color.Black));

for (int i = 0; i < 10000; i++) {

GoBasicNode child = new GoBasicNode();

child.Text = i.ToString();

child.Location = new PointF((i-5000)*100, 400);

doc.Add(child);

GoLink link = new GoLink();

link.FromPort = root.Port;

link.ToPort = child.Port;

if (i < 4000 || i > 6000)

link.Pen = linkpen;

else if (i < 4500 || i > 5500)

link.Pen = linkpen2;

else if (i < 4750 || i > 5250)

link.Pen = linkpen3;

else

link.Pen = linkpen4;

doc.Add(link);

} But perhaps you are concerned with other issues. If you zoom to fit, I don't see how you can avoid have a solid black area again, unless you perhaps remove the document's LinksLayer from the view (say when the DocScale is smaller than a particular value) because you decide that showing the link relationships isn't interesting at small scales.