簡體   English   中英

可以在單元測試庫(C#)中使用Oxyplot

[英]Can Oxyplot be used in a Unit Test Library (C#)

我正在創建一個不帶用戶界面的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);
            }

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM