Chart rendered event

2 posts, 0 answers
  1. Eduan Marais
    Eduan Marais avatar
    18 posts
    Member since:
    Feb 2010

    Posted 04 May 2011 Link to this post

    When exporting a chart, I first create a print friendly chart (a new instance of RadChart) where the legend, title, etc differs from the on-screen chart. The print friendly chart is then shown in a hidden window with a DocumentViewer. Should the chart be exported or saved before the print friendly chart is fully rendered, the saved bitmap is incorrect and incomplete. How can one determine that a RadChart has been completely rendered? Is there an event to which an event handler can be hooked?  
  2. Evgenia
    Evgenia avatar
    1437 posts

    Posted 09 May 2011 Link to this post

    Hi Eduan,

    You can handle the Loaded event of the MainWindow and then by using the Dispatcher.BeginInvoke()  method you can export the Chart as .png image. The Dispatcher's method will be called as soon as the Chart is drawn. The following code snippet demonstrates this:

    public partial class MainWindow : Window
            string imageName = "image.png";
            public MainWindow()
                int[] dataArray = new int[] { 12, 56, 23, 89, 12, 56, 34, 78, 32, 56 };
                RadChart1.DefaultView.ChartArea.EnableAnimations = false;
                RadChart1.ItemsSource = dataArray;
            void MainWindow_Loaded(object sender, RoutedEventArgs e)
            public void ExportChart()
                Dispatcher.BeginInvoke((Action)(() => { ExportChart(); }), DispatcherPriority.Background);
                RadChart1.Save(imageName, 128, 128, new PngBitmapEncoder());

    Note that the animations of the ChartArea are disabled.

    Kind regards,
    the Telerik team
    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 Public Issue Tracking system and vote to affect the priority of the items
Back to Top