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. Image for the cookie policy date

Margin for chart when saving to image

Hello,

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.

James

1 Reply

DA Devi Aruna Maharasi Murugan Syncfusion Team 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 
 
  
Regards, 
Devi 




Loader.
Live Chat Icon For mobile
Up arrow icon