Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/csharp/280.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Oxyplot能否用于单元测试库(C#)_C#_Graph_Plot_Scientific Computing_Oxyplot - Fatal编程技术网

Oxyplot能否用于单元测试库(C#)

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

我正在创建一个没有用户界面的C#库,作为单元测试库的一部分,我想从单元测试中生成的数据中保存这些图的图像。 当我将结果写入excel文件并手动生成图形时,我希望图像能够自动保存。

找到了答案- //注意:必须在输入结果中添加系列和轴

            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);
            }