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

Incomplete Initial display of organogram data

4 Answers 8 Views
Diagram
This is a migrated thread and some comments may be shown as answers.
Joe
Top achievements
Rank 1
Joe asked on 22 Jun 2014, 06:03 PM
Trying out the Diagram control, I made some changes to your Q2 2013 Organogram sample project to get my data directly from database.
I used the xml object generated from an SQL SERVER stored procedure to populate my organogram. Each time when I load my chart, only the node for the last element in the XML file is visible. I have to click on the Refresh toolbar button at the top to be able to view all the elements of my xml feed. I have two questions:
How can I programmatically invoke the Refresh command on initial load?
If I want to give focus to the topmost hierarchy (e.g. the CEO) on initial load, what do I do?

Thanks !

4 Answers, 1 is accepted

Sort by
0
Accepted
Petar Mladenov
Telerik team
answered on 25 Jun 2014, 08:20 AM
Hello Joe,

As I managed to understand your Shapes are stacked one over another initially. If so, probably you are invoking the Layout method too early. You can try to invoke it in Diagram.GraphSourceChanged event or directly use Diagram.LayoutAsync method instead of Layout.

For the next requirement (giving focus to the CEOs), you can use the DiagramLayoutComplete event and invoke Diagram.BringIntoView() method.

Regards,
Petar Mladenov
Telerik
 
Check out Telerik Analytics, the service which allows developers to discover app usage patterns, analyze user data, log exceptions, solve problems and profile application performance at run time. Watch the videos and start improving your app based on facts, not hunches.
 
0
Joe
Top achievements
Rank 1
answered on 25 Jun 2014, 02:50 PM
Many thanks, Petar. I got this working yesterday. What I did was add the following to the View's Loaded event :
var action = new Action(() => treeLayout.Layout(diagram, viewModel.ChildTreeLayoutViewModel.CurrentLayoutSettings));
            Dispatcher.BeginInvoke(action);

What remains for me now is to be able to zoom in and out of the organogram using the mouse scroll wheel. I seem to have lost that functionality, and the only means of doing that now is to use the viewport. 
Thanks again !
0
Joe
Top achievements
Rank 1
answered on 25 Jun 2014, 11:22 PM
Ok. I ended up implementing the OnMouseWheel event and using ZoomIn and ZoomOut.

private void Diagram_OnMouseWheel(object sender, MouseWheelEventArgs e)
{
     if (e.Delta > 0)
     {
           diagram.ZoomIn(zoomFactor);
      }
      else
      {
            diagram.ZoomOut(zoomFactor);
        }
    }

Interestingly, in another sample, zooming with the mouse wheel works without using the OnMouseWheel event. Both projects have zooming enabled, though.
0
Petar Mladenov
Telerik team
answered on 26 Jun 2014, 08:39 AM
Hello Joe,

You can double check your code behind to see if any custom code breaks the default zooming. We encourage you to use the built in zooming, instead of custom on MouseWheel event. You can send us an isolated sample in a new support ticket that we can look at.

Regards,
Petar Mladenov
Telerik
 
Check out Telerik Analytics, the service which allows developers to discover app usage patterns, analyze user data, log exceptions, solve problems and profile application performance at run time. Watch the videos and start improving your app based on facts, not hunches.
 
Tags
Diagram
Asked by
Joe
Top achievements
Rank 1
Answers by
Petar Mladenov
Telerik team
Joe
Top achievements
Rank 1
Share this question
or