【问题标题】:OxyPlot sum seriesOxyPlot sum 系列
【发布时间】:2017-04-04 15:46:04
【问题描述】:

我有一个带有两个 LineSeries 的 Oxyplot 图表,我想添加一个新 LineSeries,它是两个原始 LineSeries 的总和。

如何创建 Sum LineSeries?

public partial class Form1 : Form
{
    public Form1()
    {
        InitializeComponent();
        var myModel = new PlotModel { Title = "Example 1" };
        myModel.Series.Add(new FunctionSeries(function1, 0, 100, 0.1, "a*1"));
        myModel.Series.Add(new FunctionSeries(function2, 0, 100, 0.1, "b*2"));

        this.plotView1.Model = myModel;
    }

    public double function1(double a)
    {
        double result = 0;
        result = a * 1;
        return result;
    }

    public double function2(double b)
    {
        double result = 0;
        result = b * 2;
        return result;
    }
}

【问题讨论】:

    标签: c# winforms oxyplot


    【解决方案1】:

    好吧,你只需要创建另一个函数:

    public double function3(double b)
    {
       return function1(b) + function2(b);
    }
    

    然后

    myModel.Series.Add(new FunctionSeries(function3, 0, 100, 0.1, "a+b*2"));
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多