Slow loading

Hello,
I will try first to explain my framwork :
I have a context class (QDiagramEnvironnment, wich contain a GraphLinksModel object)
and a Control (MC_Qdiagram.xaml) where i have defined à go:diagram object.

<go:Diagram x:Name="myDiagram"  Unloaded="myDiagram_Unloaded"
                    InitialScale="1"  Grid.Column="2" 
                    VerticalContentAlignment="Stretch" HorizontalContentAlignment="Stretch"
                    AllowDrop="True" AllowCopy="True" AllowLink="True" AllowGroup="False"
                    NodeTemplateDictionary="{StaticResource NodeTemplateDictionary}"
                    LinkTemplateDictionary="{StaticResource LinkTemplateDictionary}"
                    Layout="{Binding Options.LayoutChoosen}"
                    Padding="10 10 0 0"
                    SelectionChanged="myDiagram_SelectionChanged"
                    UnloadingClearsPartManager="False"
                    ContextMenu="{StaticResource menuDiagram}" 
                    Model="{Binding QD_Model}"
                    ModelReplaced="myDiagram_modelreplaced">
                    <go:Diagram.LayoutManager>  
                        <go:LayoutManager Animated="False"/>
                    </go:Diagram.LayoutManager>
                    <go:Diagram.TextEditingTool>
                        <v6QDiagram:QD_TextEditingTool Starting="SingleClick"/>
                    </go:Diagram.TextEditingTool>                   
                </go:Diagram>

In my application running, first I create a context (create a GraphlinksModel with 1200nodes takes less than 1 s, all is ok).
Afterthat, the control starts loading,
I have the following events sequence : Diagram_loaded > diagram_modelreplaced > initialLayoutCompleted

but I don’t understand why it take 15s to pass from diagram_modelreplaced to initialLayoutCompleted

Here some traces :

QDiagram_Loaded <font color="#000000">09:08:34</font>
myDiagram_modelreplaced 09:08:<font color="#FF0000">36</font>
QD_Model_Changed 09:08:46 e.change:StartedTransaction, e.data :startLayout
myDiagram_InitialLayoutCompleted 09:08:<font color="#FF0000">49</font>

In this test, I have 1200nodes, i simplified template with only colored border.

I load also an overview, i will make some experiment to understand if it could take time.

If you have some ideas…
Thanks
Aurore

Embarrassed

I’m sorry, it is not a diagram problem,

I have also a treeview that presents an other view for my nodes, and if i don’t bind itemsource for the treeview, my 1200nodes are loaded like a charme !

In fact, it is also a template problem :
with simple template border
QDiagram_Loaded 10:02:37
myDiagram_modelreplaced 10:02:39
myDiagram_InitialLayoutCompleted 10:02:41

with complete template
QDiagram_Loaded 10:09:06
myDiagram_modelreplaced 10:09:19
myDiagram_InitialLayoutCompleted 10:09:22

the diagram loading take 14s.
Is it possible to virtualize the diagram (or just load on demand) ?

Thanks
Aurore

You might want to read:
Northwoods Software

The 1.3 beta kit has an improved Virtualizing sample that also does a TreeLayout, but you might not need that.

Hello,

I’ve applied your virtualization sample on my project.
But I have some troubles.
The first time, loading still slow… I will found why.
The others loading are fast.

In my application, i let the user choose it’s layout.
I transform your sample by added a combobox :

<StackPanel Grid.Row="0" Orientation="Horizontal">
      <TextBlock x:Name="myStatus" />
            <ComboBox Margin="10 0" SelectionChanged="ComboBox_SelectionChanged">
                <ComboBoxItem IsSelected="True" >Tree</ComboBoxItem>
                <ComboBoxItem>Star</ComboBoxItem>
            </ComboBox>
        </StackPanel>

And change the layout in code :

private void ComboBox_SelectionChanged(object sender, SelectionChangedEventArgs e)
    {
        ComboBox oCombo = sender as ComboBox;
        if (oCombo == null) return;
        if (oCombo.SelectedIndex == 0)
        {
            TreeLayout fLayout = new TreeLayout();
            fLayout.TreeStyle = TreeStyle.RootOnly;
            fLayout.Angle = 90.0;
            fLayout.NodeIndent = 120;
            fLayout.AlternateAngle = 90.0;
            fLayout.AlternateNodeIndent = 0;

            fLayout.Alignment = TreeAlignment.Start;
            fLayout.NodeIndentPastParent = 0; //fraction 0-1
            fLayout.NodeSpacing = 20;
            fLayout.LayerSpacing = 50;
            fLayout.LayerSpacingParentOverlap = 0; //fraction 0-1
            fLayout.Compaction = TreeCompaction.None;
            fLayout.BreadthLimit = 0;
            fLayout.RowSpacing = 20;
            fLayout.RowIndent = 10;
            fLayout.SetsPortSpot = true;
            fLayout.SetsChildPortSpot = true;
            fLayout.Sorting = TreeSorting.Ascending;

            fLayout.AlternateAlignment = TreeAlignment.Start;
            fLayout.AlternateNodeIndentPastParent = 0; //fraction 0-1
            fLayout.AlternateNodeSpacing = 20;
            fLayout.AlternateLayerSpacing = 50;
            fLayout.AlternateLayerSpacingParentOverlap = 0; //fraction 0-1
            fLayout.AlternateCompaction = TreeCompaction.None;
            fLayout.AlternateBreadthLimit = 0;
            fLayout.AlternateRowSpacing = 25;
            fLayout.AlternateRowIndent = 10;
            fLayout.AlternateSetsPortSpot = true;
            fLayout.AlternateSetsChildPortSpot = true;
            fLayout.AlternateSorting = TreeSorting.Ascending;
            fLayout.Conditions = LayoutChange.NodeAdded | LayoutChange.LinkAdded;
            //fLayout.Conditions = LayoutChange.InitialOnly;       

            if (myDiagram != null)
            {
                myDiagram.Layout = fLayout;
                myDiagram.LayoutDiagram();
            }
        }
        else
        {
            ForceDirectedLayout fLayout = new ForceDirectedLayout();
            fLayout.MaxIterations = 80;
            fLayout.Epsilon = 1;
            fLayout.InfinityDistance = 500;
            fLayout.ArrangementSpacing = new Size(50, 50);
            fLayout.DefaultElectricalCharge = 150;
            fLayout.DefaultGravitationalMass = 5;
            fLayout.DefaultSpringStiffness = 0.1;
            fLayout.DefaultSpringLength = 20;
            fLayout.Conditions = LayoutChange.NodeAdded | LayoutChange.LinkAdded;
            fLayout.SetsPortSpots = true;
            if (myDiagram != null)
            {
                myDiagram.Layout = fLayout;
                myDiagram.LayoutDiagram();
            }
        }
    }
  }

but, new layout is only applied on the visible part of partmanager.

Have you an idea ?

Aurore

But you are using the regular TreeLayout and ForceDirectedLayout. They only work on the Nodes and Links that are in the Diagram – but virtualization explicitly avoids creating those Parts that are outside of the viewport! You have to use and customize virtualized versions of all of the predefined layouts.

ok, i have ideas for treelayout
(because following your experience, i have simplified my template and fixed the frameworkelements size, then I can “layout myself”)

For the moment, I’ve no idea for forcedirectedlayout…

Thanks for your comments (and patience)

Aurore