public Series AddSeries(string name) { Series series = GetNewSeries(); series.Name = name; Serieses.Add(series); return(series); }
/// <summary> /// 初始化数据 /// </summary> /// <param name="data"></param> internal override void InitSeries(object data) { Serieses.Clear(); if (data == null) { return; } //获取集合接口 var enumerator = data as System.Collections.ICollection; if (enumerator != null) { var modelindex = 0; foreach (var d in enumerator) { var item = new Series.RadarSeries(this); item.DataContext = d; item.Index = modelindex; var color = modelindex < SeriesColors.Length ? SeriesColors[modelindex] : SeriesColors[modelindex % SeriesColors.Length]; item.LegendLabel = LegendLabel; item.Stroke = new SolidColorBrush(color); if (this.ItemTooltips != null && this.ItemTooltips.Length > 0) { item.ItemTooltipFormat = this.ItemTooltips.Length > modelindex ? this.ItemTooltips[modelindex] : this.ItemTooltips[this.ItemTooltips.Length - 1]; } else { //默认采用Y名称加Y值的格式 item.ItemTooltipFormat = "#YName:#Y"; } item.ItemClick += ItemClick; item.ItemMappings = ItemMappings; color.A = 60; item.Fill = new SolidColorBrush(color); modelindex++; this.Serieses.Add(item); } } }