Incomplete Initial display of organogram data

5 posts, 1 answers
  1. Joe
    Joe avatar
    3 posts
    Member since:
    Mar 2014

    Posted 22 Jun 2014 Link to this post

    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 !
  2. Answer
    Petar Mladenov
    Admin
    Petar Mladenov avatar
    2891 posts

    Posted 25 Jun 2014 Link to this post

    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.
     
  3. DevCraft banner
  4. Joe
    Joe avatar
    3 posts
    Member since:
    Mar 2014

    Posted 25 Jun 2014 in reply to Petar Mladenov Link to this post

    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 !
  5. Joe
    Joe avatar
    3 posts
    Member since:
    Mar 2014

    Posted 25 Jun 2014 in reply to Joe Link to this post

    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.
  6. Petar Mladenov
    Admin
    Petar Mladenov avatar
    2891 posts

    Posted 26 Jun 2014 Link to this post

    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.
     
Back to Top
DevCraft banner