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