I have an Oxyplot chart with two LineSeries and I would like to add a new LineSeries which is sum of the two original LineSeries.
How can I create the 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;
}
}
Well, you just need to create another function:
public double function3(double b)
{
return function1(b) + function2(b);
}
and then
myModel.Series.Add(new FunctionSeries(function3, 0, 100, 0.1, "a+b*2"));