This is a migrated thread and some comments may be shown as answers.

Export ChartView without rendering.

10 Answers 161 Views
ChartView
This is a migrated thread and some comments may be shown as answers.
Grégory
Top achievements
Rank 1
Grégory asked on 11 Dec 2011, 08:07 PM
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.

10 Answers, 1 is accepted

Sort by
0
Grégory
Top achievements
Rank 1
answered on 14 Dec 2011, 10:58 AM
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?
0
Giuseppe
Telerik team
answered on 14 Dec 2011, 07:01 PM
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 >>

0
Grégory
Top achievements
Rank 1
answered on 14 Dec 2011, 11:13 PM
That would be wonderful! Thank you.
0
Grégory
Top achievements
Rank 1
answered on 07 Apr 2012, 09:13 AM
Has this feature been released?
0
Nikituki
Top achievements
Rank 1
answered on 10 Apr 2012, 08:59 AM
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?
0
Giuseppe
Telerik team
answered on 11 Apr 2012, 05:33 PM
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 >>

0
Grégory
Top achievements
Rank 1
answered on 09 Jul 2012, 10:20 AM
Is this feature in progress for Silverlight?
Is this working fine with WPF?

Thank you for your answers!
0
Giuseppe
Telerik team
answered on 12 Jul 2012, 10:43 AM
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 >>

0
Kevin
Top achievements
Rank 1
answered on 22 Aug 2012, 07:32 PM
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. "
0
Giuseppe
Telerik team
answered on 27 Aug 2012, 02:29 PM
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.

Tags
ChartView
Asked by
Grégory
Top achievements
Rank 1
Answers by
Grégory
Top achievements
Rank 1
Giuseppe
Telerik team
Nikituki
Top achievements
Rank 1
Kevin
Top achievements
Rank 1
Share this question
or