From the documentation on the OxyPlot Documentation Website, it says to use the PngExporter
class. This class no longer exists in OxyPlot, but rather there are classes called PngEncoder
and PngDecoder
. I suspect the equivalent method to PngExporter.Export
is PngEncoder.Encode
however it asks for a 2d array of OxyColor
called "pixels", but I do not know where to get this data from.
NOTE: Exporting to SVG or PDF works but this form is useless.
Problem: I need to export PNGs from code only of a PlotModel
in OxyPlot but documentation is outdated.
This is the code I have been told to use:
using (var stream = File.Create(fileName))
{
var pngExporter = new PngExporter();
pngExporter.Export(plotModel, stream, 600, 400, Brushes.White);
}
Using the [GitHub Oxyplot] files to build the librarys, both oxyplot and oxyplot.wpf , and then use these libraries instead. Note any method which exports a PNG must be have the STAThread tag.