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

Centering Diagram

1 Answer 109 Views
Diagram
This is a migrated thread and some comments may be shown as answers.
Michael
Top achievements
Rank 1
Michael asked on 02 Oct 2012, 09:13 AM
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?

1 Answer, 1 is accepted

Sort by
0
Tina Stancheva
Telerik team
answered on 04 Oct 2012, 02:02 PM
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.

Regards,
Tina Stancheva
the Telerik team

Explore the entire Telerik portfolio by downloading Telerik DevCraft Ultimate.

Tags
Diagram
Asked by
Michael
Top achievements
Rank 1
Answers by
Tina Stancheva
Telerik team
Share this question
or