Last Updated: 04 Apr 2014 13:29 by Telerik Admin
Petar Marchev
Created on: 12 Nov 2013 08:28
Category: ChartView
Type: Bug Report
Chart is not exported properly when Margin is present
Chart is not exported properly when Margin is present.
1 comment
Imported User
Posted on: 10 Jan 2014 14:50
The workaround I found for this was to export the entire UserControl that hosts the charts, then render only the control(Grid in my case) that hosts the charts.  You will then have to trim/crop the image you end up with in the event other controls on the same UserControl didn't get rendered.

My Code (notice I capture "this" and only render the grid that my charts are hosted in, chartsGrid):
            RenderTargetBitmap rtb = new RenderTargetBitmap((int)this.ActualWidth, (int)this.ActualHeight, 96, 96, PixelFormats.Pbgra32);

            var bitmapImage = new BitmapImage();
            var bitmapEncoder = new BmpBitmapEncoder();

            PngBitmapEncoder png = new PngBitmapEncoder();

            ImageInline img = null;

            using (MemoryStream stream = new MemoryStream())

                //Scale down to 3/4th size of original
                img = new ImageInline(stream, new Size(this.ActualWidth * .75, this.ActualHeight * .75), "png");