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: June 24, 2019).
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

SfChart3D export image cropped

Thread ID:

Created:

Updated:

Platform:

Replies:

150667 Jan 15,2020 01:05 PM UTC Jan 17,2020 10:18 AM UTC WPF 1
loading
Tags: SfChart
Ondrej Svoboda
Asked On January 15, 2020 01:05 PM UTC

Hi,
when rotation in 3D chart is enabled it easily happens that chart overflows control region and exported image is then cropped by this region (see attachment). Is there a way how to prevent this?

Thanks

Attachment: Chart_988c99d3.zip

Samuel Rajadurai Edwin Rajamanickam [Syncfusion]
Replied On January 17, 2020 10:18 AM UTC

Hi Ondrej, 
Thank you for using Syncfusion product. 
We have evaluated your requirement of preventing the 3D chart from getting cropped in chart export. This can be achieved by exporting the parent panel of the chart instead of the chart itself.  
Note: Please set the required Margin for the chart to provide ambient space for its rotation that prevents the chart from being cropped. 
  
Code Snippet - XAML 
  
<Grid Name="ChartGrid" Background="White"> 
  
<chart:SfChart3D …/>  
  
</Grid> 
  
  
Code Snippet – C# 
  
private void ExportButton_Click(object sender, RoutedEventArgs e) 
{ 
    var grid = ChartGrid; 
    RootGrid.UpdateLayout(); 
  
    var imageEncoder = new JpegBitmapEncoder(); 
    RenderTargetBitmap bitmap = new RenderTargetBitmap((int)grid.ActualWidth, (int)grid.ActualHeight, 96, 96, PixelFormats.Pbgra32); 
    bitmap.Render(grid); 
    imageEncoder.Frames.Add(BitmapFrame.Create(bitmap)); 
  
    using (Stream stream = File.Create("Chart3D")) 
    { 
        imageEncoder.Save(stream); 
    } 
} 
  
  
Output 
 
  
Regards,
Samuel
 


CONFIRMATION

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

This page will automatically be redirected to the 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

Live Chat Icon For mobile
Live Chat Icon