目前,我可以一次导出一个PlotModel
作为.png
,使用:
public void CreatePNG(PlotModel plotModel, string fileName, Stream stream)
{
var pngExporter = new PngExporter { Width = 600, Height = 400, Background = OxyColors.White };
pngExporter.Export(plotModel, stream);
}
有没有办法导出2个PlotModel
,使它们在PlotModel
文件中看起来像这样?
或者,我可以连接2个.png
个文件吗?
答案 0 :(得分:0)
我想出了如何在OxyPlot
文件中导出多个.png
图表,方法是将它们转换为Bitmap
。
这是一个示例代码:
var stream1 = new MemoryStream();
var stream2 = new MemoryStream();
var pngExporter = new PngExporter {Width = 600, Height = 400, Background = OxyColors.White};
var pngExporter2 = new PngExporter {Width = 600, Height = 400, Background = OxyColors.White};
pngExporter.Export(plotModel1, stream1);
pngExporter2.Export(plotModel2, stream2);
System.Drawing.Bitmap b1 = new System.Drawing.Bitmap(Image.FromStream(stream1));
System.Drawing.Bitmap b2 = new System.Drawing.Bitmap(Image.FromStream(stream2));
System.Drawing.Bitmap img = new System.Drawing.Bitmap(600, 800);
Graphics g = Graphics.FromImage(img);
g.DrawImage(b1, 0, 0);
g.DrawImage(b2, 0, 400);
img.Save(stream.ToString());