We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. (Last updated on: November 16, 2018).
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

Margin for chart when saving to image

Thread ID:





129471 Mar 20,2017 06:34 PM UTC Mar 21,2017 09:59 AM UTC WPF 1
Tags: SfChart
Asked On March 20, 2017 06:34 PM UTC


When I try saving a column chart to an image (jpg), I'm trying to add some margin to the sides of the chart. It seems like the Margin property only applies to the UserControls in which the chart is placed. When the chart image is saved using the Save method, all the margin is removed. It doesn't seem like the Padding property works for this either.

If it matters, I'm trying to save this image without showing it on the screen and am using the UIElement.Measure() and Arrange() methods.

Thanks in advance for any help you can provide.


Devi Aruna Maharasi Murugan [Syncfusion]
Replied On March 21, 2017 09:59 AM UTC

Hi James, 
Thanks for contacting Syncfusion Support. 
We have exported chart as image by using RenderTargetBitmap. If control background is “Transparent”, then output of control image background will be “Black” in RenderTargetBitmap. So, while applying the background for SfChart, it will get applied to SfChart by excluding its margin (margin parts of control also exported, but it is not visible due to black background). 
However, we have achieved your requirement by placing the chart inside an additional container (Grid). We have prepared a demo sample for your requirement and it can be downloaded from below link, 
Sample: Save129471 
Please find the screenshot of exported image 


This post will be permanently deleted. Are you sure you want to continue?

Sorry, An error occured while processing your request. Please try again later.

Please sign in to access our forum

or the page will be automatically redirected to sign-in page in 10 seconds.

Warning Icon You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.Close Icon