Centering Diagram

2 posts, 0 answers
  1. Michael
    Michael avatar
    2 posts
    Member since:
    Oct 2012

    Posted 02 Oct 2012 Link to this post

    Is there any easy way to center a diagram? I believe I may need to use the align feature, but not 100% sure.

    I've been using autofit and that centers it however when exporting to an image, even with the bounds set for the entire viewport it doesn't export in the center.

    Any ideas on what I can try?
  2. Tina Stancheva
    Tina Stancheva avatar
    3298 posts

    Posted 04 Oct 2012 Link to this post

    Hello Michael,

    The RadDiagram.ExportToImage method has multiple overloads that allow you to customize the export. One of the overloads allow you to define a portion of the diagram to be exported through a Rect argument:
    private void ExportToImage(object sender, RoutedEventArgs e)
        using (var stream = File.Open(@"c:\temp\xDiagram.png", FileMode.Create))
            xDiagram.ExportToImage(stream,null,new Rect(10,10,150,150));
    You can read more about the overloads of the method in our documentation.

    I am not sure if I properly understand your case and scenario, but you should be able to use the overload of the method to export only the center portion of your diagram.

    Please give this a try and let us know if it helps.

    Tina Stancheva
    the Telerik team

    Explore the entire Telerik portfolio by downloading Telerik DevCraft Ultimate.

  3. DevCraft R3 2016 release webinar banner
Back to Top