My code is:
using OxyPlot;
using OxyPlot.Series;
namespace WinFormsApp1
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
var myModel = new PlotModel { Title = "Example 1" };
myModel.Series.Add(new FunctionSeries(Math.Cos, 0, 10, 0.1, "cos(x)"));
this.plotView1.Model = myModel;
}
}
}
The result is: enter image description here
As you can see from the image, there is no title 'cos(x)' of the serie.
I followed this example. But the result is: enter image description here
Add this namespace
using OxyPlot.Legends;
And this code
Legend legend = new Legend();
legend.LegendPosition = LegendPosition.RightTop;
myModel.Legends.Add(legend);
Unfortunately the OxyPlot docs tend to fall behind. The best way to solve problems like this, when the docs are out of date or incomplete, is to clone the repo and then run the examples. The WPF sample browser lets you see the code easily, I took the above code from the ErrorSeries example under "Custom series".