public void addSeries(string graphName, string seriesLabel, Primitive data, string colour, eLineType type)
{
Type GraphicsWindowType = typeof(GraphicsWindow);
Dictionary<string, UIElement> _objectsMap;
UIElement obj;
try
{
_objectsMap = (Dictionary<string, UIElement>)GraphicsWindowType.GetField("_objectsMap", BindingFlags.NonPublic | BindingFlags.Static | BindingFlags.IgnoreCase).GetValue(null);
if (!_objectsMap.TryGetValue(graphName, out obj))
{
Utilities.OnShapeError(Utilities.GetCurrentMethod(), graphName);
return;
}
try
{
Canvas _graph = (Canvas)obj;
plotData _plotData = getPlotData(graphName);
// Create new series if needed (otherwise its just the graph background)
if (null != data)
{
bool bFound = false;
seriesData newSeries = createSeries(seriesLabel, data, colour, type);
foreach (seriesData series in _plotData.series)
{
if (series.name == seriesLabel)
{
series.CopyFrom(newSeries);
bFound = true;
break;
}
}
if (!bFound) _plotData.series.Add(newSeries);
}
delegate_Data = new object[] { _graph, _plotData, eZoom.FALSE, eRescale.TRUE };
FastThread.Invoke(plotSeries_Delegate);
}
catch (Exception ex)
{
Utilities.OnError(Utilities.GetCurrentMethod(), ex);
}
}
catch (Exception ex)
{
Utilities.OnError(Utilities.GetCurrentMethod(), ex);
}
}