Oxyplot能否用于单元测试库(C#)
我正在创建一个没有用户界面的C#库,作为单元测试库的一部分,我想从单元测试中生成的数据中保存这些图的图像。 当我将结果写入excel文件并手动生成图形时,我希望图像能够自动保存。找到了答案- //注意:必须在输入结果中添加系列和轴Oxyplot能否用于单元测试库(C#),c#,graph,plot,scientific-computing,oxyplot,C#,Graph,Plot,Scientific Computing,Oxyplot,我正在创建一个没有用户界面的C#库,作为单元测试库的一部分,我想从单元测试中生成的数据中保存这些图的图像。 当我将结果写入excel文件并手动生成图形时,我希望图像能够自动保存。找到了答案- //注意:必须在输入结果中添加系列和轴 PlotModel model = new PlotModel() { Title = "Sample"}; model.IsLegendVisible = true; model.LegendP
PlotModel model = new PlotModel() { Title = "Sample"};
model.IsLegendVisible = true;
model.LegendPosition = LegendPosition.RightMiddle;
model.LegendPlacement = LegendPlacement.Outside;
model.PlotType = PlotType.XY;
using (var stream = File.Create(Environment.CurrentDirectory + "/image.png"))
{
OxyPlot.Wpf.PngExporter exporter = new OxyPlot.Wpf.PngExporter() { Width = 2200, Height = 1400, Resolution = 200 };
exporter.Export(model, stream);
}