public int AddLineSeries(string title, string description = "", bool isVisible = true) { //TODO: improve how to limit the number of plots //For now, we just ignore series after the max number has been reached if (Plot.Series.Count < m_maxNumSeries) { if (m_lineSeriesLock == null) //might be null if loaded from file { m_lineSeriesLock = new object(); } lock (m_lineSeriesLock) { OxyPlot.Series.LineSeries newSeries = new OxyPlot.Series.LineSeries { Title = title, MarkerType = MarkerType.None }; newSeries.IsVisible = isVisible; Plot.Series.Add(newSeries); PlotLineSeriesPropertiesViewModel lineProps = Properties.LineSeriesByName(title); if (lineProps == null) { Properties.AddLineSeries(title, description, newSeries); } else { lineProps.LineSeries = newSeries; } return(Plot.Series.Count - 1);; } } return(-1); }