Export ChartView without rendering.

11 posts, 0 answers
  1. Grégory
    Grégory avatar
    21 posts
    Member since:
    Mar 2011

    Posted 11 Dec 2011 Link to this post

    Is it possible to Export ChartView when the control is not presented in the Visual Tree. Without rendering. I know that the RadChart doesn't work.
  2. Grégory
    Grégory avatar
    21 posts
    Member since:
    Mar 2011

    Posted 14 Dec 2011 Link to this post

    There is an example over here:
    http://www.telerik.com/help/silverlight/radchart-features-export-to-pdf.html
    in the chapter:
    Exporting RadChart when the control is not presented in the Visual Tree.
    It is working only for WPF, not for Silverlight.
    What about the ChartView. Is it working for this control?
  3. DevCraft banner
  4. Giuseppe
    Admin
    Giuseppe avatar
    2363 posts

    Posted 14 Dec 2011 Link to this post

    Hello Grégory,

    Unfortunately at the moment RadChartView does not support this scenario properly either but we will do our best to address this limitation for the Q1 2012 official release.


    Greetings,
    Giuseppe
    the Telerik team

    Explore the entire Telerik portfolio by downloading the Ultimate Collection trial package. Get it now >>

  5. Grégory
    Grégory avatar
    21 posts
    Member since:
    Mar 2011

    Posted 14 Dec 2011 Link to this post

    That would be wonderful! Thank you.
  6. Grégory
    Grégory avatar
    21 posts
    Member since:
    Mar 2011

    Posted 07 Apr 2012 Link to this post

    Has this feature been released?
  7. Nikituki
    Nikituki avatar
    34 posts
    Member since:
    Nov 2011

    Posted 10 Apr 2012 Link to this post

    Hello,

    At http://www.telerik.com/help/silverlight/radchart-features-export-to-pdf.html has an example only for RadChart.
    Is there a similar functionality for RadChartView?
  8. Giuseppe
    Admin
    Giuseppe avatar
    2363 posts

    Posted 11 Apr 2012 Link to this post

    Hello there,

    @Grégory -- unfortunately this functionality is not available in the Silverlight version of the control yet as we still are unable to workaround the platform limitations that prevent this scenario from working correctly there in the first place. Our developers are still looking for possible solutions but at this point we cannot commit a specific timeframe as most probably it would be misleading again.

    @Nikituki -- you can use the same approach for RadChartView as well; you just need to replace this line of RadChart export-to-image code:

    RadChart1.ExportToImage(ms, new PngBitmapEncoder());

    with this line for RadChartView (RadChartView does not provide built-in export API like RadChart but internally RadChart uses the same extension methods):
    Telerik.Windows.Media.Imaging.ExportExtensions.ExportToImage(RadChart1, ms, new PngBitmapEncoder());



    Greetings,
    Giuseppe
    the Telerik team

    Explore the entire Telerik portfolio by downloading the Ultimate Collection trial package. Get it now >>

  9. Grégory
    Grégory avatar
    21 posts
    Member since:
    Mar 2011

    Posted 09 Jul 2012 Link to this post

    Is this feature in progress for Silverlight?
    Is this working fine with WPF?

    Thank you for your answers!
  10. Giuseppe
    Admin
    Giuseppe avatar
    2363 posts

    Posted 12 Jul 2012 Link to this post

    Hello Gregory,

    The same platform limitations that prevent this scenario to work correctly for RadChart for Silverlight still apply for RadChartView for Silverlight so we cannot provide any additional update on this.

    As for WPF -- everything works as expected like this:
    private void Button_Click(object sender, RoutedEventArgs e)
    {
        this.SaveImage();
    }
     
    private void SaveImage()
    {
        RadCartesianChart chart = new RadCartesianChart();
     
        chart.BeginInit();
     
        chart.Width = 600;
        chart.Height = 400;
     
        chart.HorizontalAxis = new CategoricalAxis();
        chart.VerticalAxis = new LinearAxis();
     
        BarSeries series = new BarSeries();
        series.DataPoints.Add(new CategoricalDataPoint() { Category = "C1", Value = 10 });
        series.DataPoints.Add(new CategoricalDataPoint() { Category = "C2", Value = 20 });
        series.DataPoints.Add(new CategoricalDataPoint() { Category = "C3", Value = 30 });
        series.DataPoints.Add(new CategoricalDataPoint() { Category = "C4", Value = 10 });
        series.DataPoints.Add(new CategoricalDataPoint() { Category = "C5", Value = 20 });
     
        chart.Series.Add(series);
     
        chart.EndInit();
     
        chart.Measure(new System.Windows.Size(chart.Width, chart.Height));
        chart.Arrange(new System.Windows.Rect(new Point(0, 0), chart.DesiredSize));
     
        Telerik.Windows.Media.Imaging.ExportExtensions.ExportToImage(chart, "C:\\image1.png", new PngBitmapEncoder());
    }



    Regards,
    Giuseppe
    the Telerik team

    Explore the entire Telerik portfolio by downloading the Ultimate Collection trial package. Get it now >>

  11. Kevin
    Kevin avatar
    1 posts
    Member since:
    Jul 2010

    Posted 22 Aug 2012 Link to this post

    What are the platform limitations?

    "The same platform limitations that prevent this scenario to work correctly for RadChart for Silverlight still apply for RadChartView for Silverlight so we cannot provide any additional update on this. "
  12. Giuseppe
    Admin
    Giuseppe avatar
    2363 posts

    Posted 27 Aug 2012 Link to this post

    Hello Kevin,

    One of the major problems is that you cannot force the execution of ApplyTemplate(...) for custom control in Silverlight without adding it to the visual tree, hence the export-to-image functionality cannot operate correctly.


    All the best,
    Giuseppe
    the Telerik team

    Explore the entire Telerik portfolio by downloading Telerik DevCraft Ultimate.

Back to Top
DevCraft banner