【问题标题】:Can Oxyplot be used in a Unit Test Library (C#)Oxyplot 可以在单元测试库(C#)中使用吗
【发布时间】:2015-11-30 10:29:16
【问题描述】:

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

【问题讨论】:

    标签: c# graph plot scientific-computing oxyplot


    【解决方案1】:

    找到答案 - //注意必须添加一个系列和轴输入结果...

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

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2016-07-17
      • 2022-01-22
      • 1970-01-01
      • 1970-01-01
      • 2022-09-30
      • 2019-08-25
      相关资源
      最近更新 更多