我有一个带有两个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;
}
}
答案 0 :(得分:0)
嗯,你只需要创建另一个函数:
public double function3(double b)
{
return function1(b) + function2(b);
}
然后
myModel.Series.Add(new FunctionSeries(function3, 0, 100, 0.1, "a+b*2"));