Hi,
I have same problem now. Not able to solve it.
In WPF application with MVVM pattern, I have the following timer method in the model:
I have same problem now. Not able to solve it.
In WPF application with MVVM pattern, I have the following timer method in the model:
public int ctr = 0;
void RefreshElapsed(object sender, ElapsedEventArgs e)
{
if (Simulated)
{
var link = ctr % 10;
var series = GetDummySeries("Left" + ctr);
AddSeriesLeft(series, ChartTypeEnum.Voltage, link);
series = GetDummySeries("Right" + ctr);
AddSeriesRight(series, ChartTypeEnum.Voltage, link);
}
RightPlot.FadeSeries(127, OxyColors.Blue);
LeftPlot.FadeSeries(127, OxyColors.Blue);
Application.Current.Dispatcher.BeginInvoke(new Action(() =>
{
RightPlot.RefreshPlot(true);
LeftPlot.RefreshPlot(true);
}));
ctr++;
}
I get the following exception:A first chance exception of type 'System.InvalidOperationException' occurred in OxyPlot.dll
Additional information: XAxis not defined.
Stack: at OxyPlot.Series.XYAxisSeries.VerifyAxes() in c:\TeamCity\buildAgent\work\3b9fcf1ba397d0ed\Source\OxyPlot\Series\XYAxisSeries.cs:line 417
First I did not have the invoke but I thought it was a race condition so I made it run in the correct thread, but still something is wrong. Also the XAxis is not defines is really strange, since I actually add xaxis like so in the constructor of the view model: LeftPlot.Axes.Add(new LinearAxis(AxisPosition.Bottom, "Time [ms]"));
RightPlot.Axes.Add(new LinearAxis(AxisPosition.Bottom, "Time [ms]"));
I will try and put some Keys for the default x axis.