using Export in RadCartesianChart

2 posts, 1 answers
  1. Shin
    Shin avatar
    1 posts
    Member since:
    Feb 2015

    Posted 09 Nov 2015 Link to this post

    first forgive poor my english written


    I Export to PNG before setting Zoom property is 5, 1 => 1, 1

    but Export image is still 5, 1 Zoom setting


     in XAML Code

    1.<!-- already Zoom property is 5,1 setting-->
    2.<telerik:RadCartesianChart Grid.Column="0" Grid.Row="1" x:Name="trfChart1" Palette="Windows8" Zoom="5,1">


    in cs Code

    1.// this.myChart.Zoom = new Size(5, 1) already setting Zoom property     
    2.string filename = "C:\\ExportedChart.png";
    3.using (System.IO.Stream fileStream = System.IO.File.Open(filename, System.IO.FileMode.OpenOrCreate))
    5.   this.trfChart1.Zoom = new Size(1, 1); // When before Export Zoom Property set Zoom 1, 1
    6.   Telerik.Windows.Media.Imaging.ExportExtensions.ExportToImage(this.trfChart1, fileStream, new System.Windows.Media.Imaging.PngBitmapEncoder());
    8.// But Export result is still Zoom 5, 1 setting


     please give advise 





  2. Answer
    Martin Ivanov
    Martin Ivanov avatar
    1442 posts

    Posted 10 Nov 2015 Link to this post

    Hello Shin,

    The chart is not exported with the new zoom level because it is not yet measure and arranged with the e Measure() and Arrange() methods of the chart right before the Exnew zoom. In order to achieve the desired effect you can manually call thportToImage() call.
    this.trfChart1.Zoom = new Size(1, 1);
    var size = trfChart1.RenderSize;
    this.trfChart1.Arrange(new Rect(size));
    Telerik.Windows.Media.Imaging.ExportExtensions.ExportToImage(this.trfChart1, fileStream, new System.Windows.Media.Imaging.PngBitmapEncoder());

    I hope this helps.

    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Feedback Portal and vote to affect the priority of the items
Back to Top