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
close icon

SfChart3D export image cropped

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

1 Reply

SR Samuel Rajadurai Edwin Rajamanickam Syncfusion Team 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
 


Loader.
Live Chat Icon For mobile
Up arrow icon