You just need to make sure that the LayeredDigraphVertex.Layer property is set to the same value for nodes in the different streams, if you want them to get the same X coordinate location.
I have another problem. I am trying to code what you just told me but because I use a different layout for each Links group(Red and Blue above), I can’t access the vertex from other layouts.
Presumably you have some context object that holds all of the streams.
Hopefully you can determine, on demand, how many layers each stream will need and the relative relationships between them so that you can compute the total number of layers.
(Perhaps the total is greater than the maximum number of layers used by any one stream.)
You can then customize your layout to refer to that object, so that your AssignLayers override can determine the proper layer “globally” for each vertex/node.
So there is no way to directly access the network.vertexes of another layout ?
Well, I suppose that could be arranged, but you would still have the problem that when a layout occurs, you would not know about the layering of all of the other nodes in the whole diagram. So that would require a subsequent pass to shift individual layouts to the left or right or to split them. I did suggest that a while ago. My impression was that that was too complicated or perhaps I just didn’t make myself clear. I certainly do not know the complexities of your application.
I would like to give it a try, so I would be thankful if you could explain me how to arrange it so I can access directly my network.vertexes from another layout.
Thank youThe main problem is that the LayeredDigraphLayout.Network is normally constructed and discarded with each layout performance. And even if you kept the network around when it finished laying out, obviously there would not be any such data structure for those layouts that had not yet executed.
So are you sure that you still want to do that?
Would it work if I wait until all layouts have finished laying out and then when the last one starts laying I do all my operations? If that works I would like to give it a try, if I can’t do that then I will try the Context Object you told me about before.
That wouldn’t address the cases where earlier layouts would need to be adjusted to account for the positioning (layering) that the later layouts determine.
I still believe that using a single layout for the whole diagram is the best and probably the only good solution.
Ok thank you very much for your help Walter
Hi Walter,
Route.Adjusting is just used when recomputing the route. Is the layout actually positioning the nodes or are you explicitly moving them in code?
I’m concerned that reversing the order of the layers is insufficient – you also need to reverse the links. Otherwise the spots that are chosen for how links connect to nodes will be wrong. But you can get around that by turning off LayeredDigraphLayout.SetsPortSpots and set the port spots yourself. But this issue would not explain why the routing for the links results in congruent links.
OK, then you also need to set the FromSpot and ToSpot attached properties appropriately on those nodes where the links are going “backwards”, or you can set them directly on the Route (which is what the layouts do). Maybe go:Node.FromSpot=“MiddleLeft” and go:Node.ToSpot=“MiddleRight”.
Although that doesn’t explain why the vertical distance between the link middles is less than in the red case.
You could try what I first suggested: reverse all of the links.
Or you could continue having the links going from left to right, but just exchange any arrowheads: set go:LinkPanel.FromArrow instead of go:LinkPanel.ToArrow.
I do not know your application requirements, so it’s hard for me to say.
Could you explain me how can I reverse the links ? What do I need to do ?
Just swap the “from” and “to” references in the link data (if you are using a GraphLinksModel).
It would have been easy to only change the ArrowHead and let the streams going from left to right, but in my model, I use the From and To to browse the streams. So I can’t use this approach.
If we use your other approach, which is to swap the from and to of each link. Here is what will happen.
So I don’t know if I really understand the concept of swapping the link, but at the end, cold streams will be on the same side as the hot streams.
Have I missed something?