Recently there has been a great demand for the XamDataCharts to be exported outside their respectful applications as images. Usually WPF provides the functionality that is needed to extract an image of any control that inherits from the Visual class. Also with the help of the Infragistics Excel engine and I have been able to gather in a singles sample project (XamDataChart_to_Image.zip) exporting to: Excel, *.png, *jpg and the Clipboard.
The XamDataChart is a cross-platform control (meaning it is available for both Silverlight and WPF) and of course this causes some difference in implementation.
Because of the difference in accessibility to the user’s machine between WPF and Silverlight I have only been able to get the WPF XamDataChart to be saved to the Clipboard (like with print screen).
The other major issue in Silverlight is the lack of the RenderTargetBitmap class that is used in WPF to extract the visual and also the PngBitmapEncoder and JpegBitmapEncoder classes is used in WPF to convert the extracted data to the needed format. This where the Infragistics Reporting team steps in with the InfragisticsSL4.Reports.Imaging.v11.2 assembly. This has been created mainly to serve the NetAdvantage Reporting package in creating its xaml based reports, however I’ve managed to put it to another good use as per your demands. Actually the assembly provides simplified version of the above mentioned classes to be used in Silverlight and they go respectively: WriteableBitmap, PngImageEncoder, JpegImageEncoder. Using all that, I have created another sample project (XamPieChart_to_image.zip) that creates images out of the XamPieChart and exports them to: Excel, *.png and *jpg.
Also in the Silverlight sample I decided to create an image out of the containing Grid control and not from the XamPieChart directly. That way I am able to also include the XamPieChart’s ItemLegend control in the exported images.
Hope you like all this.