This is a migrated thread and some comments may be shown as answers.

Size of Diagram for AutoLayout

4 Answers 84 Views
Diagram
This is a migrated thread and some comments may be shown as answers.
Tulio
Top achievements
Rank 1
Tulio asked on 19 Mar 2019, 02:41 AM

Hi!

When creating a diagram with too many items with AutoLayout, it seems there is a maximum width the diagram will grow to.

Which causes a weird behavior of the items being places vertically.

 

Is it possible to set the width of the available space for the auto layout?

 

I've added a screenshot demonstrating the behavior.

 

Thanks!

4 Answers, 1 is accepted

Sort by
0
Petar Mladenov
Telerik team
answered on 19 Mar 2019, 05:18 PM
Hello Tulio,

Please check out the settings you can apply to Diagram Layout:

Diagram Layout Settings

ComponentsGridWidth should be the property you need. Please let us know if it works well for your scenario or not.

Regards,
Petar Mladenov
Progress Telerik
Get quickly onboarded and successful with your Telerik and/or Kendo UI products with the Virtual Classroom free technical training, available to all active customers. Learn More.
0
Tulio
Top achievements
Rank 1
answered on 19 Mar 2019, 06:06 PM

Hi Petar,

 

I could not make it work with AutoLayout set to true though. I can see that this works fine if you don't have AutoLayout, but for my scenario I would like to be able to use AutoLayout. Is it possible?

 

0
Petar Mladenov
Telerik team
answered on 22 Mar 2019, 07:47 AM
Hello Tulio,

Yes, the auto layout feature invokes the layout with default null settings. However, it should be easy to implement auto layout logic on your own:

- use the ItemsChanged event or ContainerGenerator.StatusChanged (with ContainersGenerated status) events of the RadDiagram and invoke LayoutAsync method with your custom settings. This is basically what auto layout does internally
- there is a private fields in RadDiagram:
private object asyncLayoutSettings = null;

If you invoke LayoutAsync with custom settings, they are assigned to the mentioned field:
public void LayoutAsync(LayoutType type = LayoutType.Sugiyama, object settings = null)
     {
         this.asyncLayoutType = type;
         this.asyncLayoutSettings = settings;
         this.shouldLayout = true;
     }

And if AutoLayout is true, these settings are used for auto layout. So basically, you can combine single invocation of LayoutAsync early in your application and set AutoLayout true. 

Regards,
Petar Mladenov
Progress Telerik
Get quickly onboarded and successful with your Telerik and/or Kendo UI products with the Virtual Classroom free technical training, available to all active customers. Learn More.
0
Tulio
Top achievements
Rank 1
answered on 22 Mar 2019, 07:05 PM

It works!

Thanks for the help!

Tags
Diagram
Asked by
Tulio
Top achievements
Rank 1
Answers by
Petar Mladenov
Telerik team
Tulio
Top achievements
Rank 1
Share this question
or