17 using System.Collections.Generic;
20 using Newtonsoft.Json;
21 using Newtonsoft.Json.Serialization;
34 public string Name {
get;
set; } =
string.Empty;
37 [Obsolete(
"ChartType is now obsolete. Please use Series indexes instead by setting index in the series constructor.")]
42 public Dictionary<string, BaseSeries>
Series {
get;
set; } =
new();
47 [JsonProperty(DefaultValueHandling = DefaultValueHandling.Ignore)]
53 [JsonProperty(DefaultValueHandling = DefaultValueHandling.Ignore)]
66 [Obsolete(
"ChartType is now obsolete and ignored in charting. Please use Series indexes instead by setting index in the series constructor.")]
70 Series =
new Dictionary<string, BaseSeries>();
78 public Chart(
string name) : this(name, null)
91 Series =
new Dictionary<string, BaseSeries>();
107 throw new DuplicateNameException($
"Chart.AddSeries(): ${Messages.Chart.ChartSeriesAlreadyExists}");
125 if (forceAddNew || !
Series.TryGetValue(name, out series))
127 series =
new Series(name, type, index, unit)
147 if (forceAddNew || !
Series.TryGetValue(name, out chartSeries))
149 Series[name] = chartSeries = templateSeries.
Clone(empty:
true);
167 copy.AddSeries(series.GetUpdates());
170 catch (Exception err)
185 foreach (var kvp
in Series)
187 chart.Series.Add(kvp.Key, kvp.Value.Clone());