Copy chart to clipboard

Oystein Bjorke vor 10 Jahren 0
This discussion was imported from CodePlex

jacobc1000 wrote at 2012-11-24 13:59:

Hi,

Thanks for a great project. It really works!

 

I am currently using it for a project that generates various barchart- and scatter charts. I'm using WPF and MVVM where the PlotModel is generated in the viewmodel each time the user changes criteria. The chart itself is hosted in <oxy:ploy> control.

I need to be able to copy the visual representation (i.e. the <oxy:plot> control) to the clipboard. Preferably as a vector image to insert into MS Office applications. I know that generating WMF/EMF files from WPF is challenging at best so a simple bitmap could also do.

What is the best way of accomplishing this? Thanks.


objo wrote at 2012-11-26 06:05:

Try Ctrl-C, the Plot control is bound to ApplicationCommands.Copy.

The Plot control also has SaveBitmap, ToBitmap, ToXaml,  methods.

Or use PngExporter, SvgExporter, PdfExporter etc.


Tephyrnex wrote at 2013-03-18 15:33:

I've searched all of the .NET 4 source and the only reference I find to Keys.C is in Plot.cs (WinForm) (OnPreviewKeyDown) and that section of code doesn't copy a BMP to the clipboard. If anyone can shed light, it would be much appreciated.