Some of the error messages disappeared after fully qualifying to use OxyPlot.Series.LineSeries (instead of OxyPlot.Wpf.LineSeries)
However, there's error at the code:
temp.Axes.Add(new OxyPlot.Axes.LinearAxis(AxisPosition.Left, -4, 4));
Error:
The name 'AxisPosition' does not exist in the current context
If we have to use OxyPlot.* objects over OxyPlot.Wpf.* (LineSeries, LinearAxes) then how are we using oxyplot WPF classes for WPF application?
OxyPlot.PlotModel temp = new PlotModel("Square wave");
OxyPlot.Series.LineSeries ls = new OxyPlot.Series.LineSeries("sin(x)+sin(3x)/3+sin(5x)/5+...");
int n = 10;
for (double x = -10; x < 10; x += 0.0001)
{
double y = 0;
for (int i = 0; i < n; i++)
{
int j = i * 2 + 1;
y += Math.Sin(j * x) / j;
}
ls.Points.Add(new DataPoint(x, y));
}
temp.Series.Add(ls);
temp.Axes.Add(new OxyPlot.Axes.LinearAxis(AxisPosition.Left, -4, 4));
temp.Axes.Add(new OxyPlot.Axes.LinearAxis(AxisPosition.Bottom));
MyPlotModel = temp; // this is raising the INotifyPropertyChanged event
Also, get the error:
The name 'MyPlotModel' does not exist in the current context
Thanks,
-srinivas y.
↧