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

Show diagram is slow

1 Answer 149 Views
Diagram
This is a migrated thread and some comments may be shown as answers.
Maite
Top achievements
Rank 1
Maite asked on 06 Mar 2015, 11:26 AM
Hello,
 
I have a RadDiagram in which I load 400 items with almost 50 binding properties per-item, like for example BackgroundColor, FontSize, Width, Height, Visibility, etc…

Example of BackgroundColor property for binding: 

private Brush backgroundColor ;
public Brush BackgroundColor
{
      get{ return backgroundColor; }
      set
      {
              backgroundColor = value;
              OnPropertyChanged(“BackgroundColor”);
      }


Each item is a derived class from MyNode:NodeViewModelBase with DataTemplate:  

<telerik:RadDiagram.ShapeStyle>               
       <Style TargetType="telerik:RadDiagramShape">
               <Setter Property="Position" Value="{Binding Position, Mode=TwoWay}" />                  
               <Setter Property="Background" Value="{Binding BackgroundColor} " />                   
               <Setter Property="BorderBrush" Value="Transparent" />
               ……………

The performance is very bad. It last up to 5 seconds to display the whole diagram with all items over it.  

Any help to enhance the performance?

1 Answer, 1 is accepted

Sort by
0
Pavel R. Pavlov
Telerik team
answered on 11 Mar 2015, 08:05 AM
Hello Maite,

I already answered to this question in your other thread. However, I will paste the same answer here so that it may help others from the community.

I can see that you have completely predefined the ControlTemplate of the RadDiagramShape. You need to keep in mind that such tremendous changes are out of our support scope. This means that the performance and the optimizations over those shapes is up to you.

Let me give you some tips about your current implementation of the MVVM approach. In order to stick to that approach you should not hold any visual elements in your ViewModels. You should hold the information based on which you will be able to create the UI. For example instead of saving property of type Brush, you can save property of type string and preserve only the HEX code of the color. Also, saving Image is bad practice. You can save only the path to that image and achieve the same result. This also may improve the performance of your application.

Regards,
Pavel R. Pavlov
Telerik
 

Check out the Telerik Platform - the only platform that combines a rich set of UI tools with powerful cloud services to develop web, hybrid and native mobile apps.

 
Tags
Diagram
Asked by
Maite
Top achievements
Rank 1
Answers by
Pavel R. Pavlov
Telerik team
Share this question
or