Esempio n. 1
0
        public static bool IsSerieLegend(BaseChart chart, string legendName, SerieType type)
        {
            foreach (var serie in chart.series.list)
            {
                if (serie.type == type)
                {
                    switch (serie.type)
                    {
                    case SerieType.Pie:
                    case SerieType.Radar:
                    case SerieType.Ring:
                        foreach (var serieData in serie.data)
                        {
                            if (legendName.Equals(serieData.name))
                            {
                                return(true);
                            }
                        }
                        break;

                    case SerieType.Custom:
                        if (chart.GetCustomSerieDataNameForColor())
                        {
                            foreach (var serieData in serie.data)
                            {
                                if (legendName.Equals(serieData.name))
                                {
                                    return(true);
                                }
                            }
                        }
                        else
                        {
                            if (legendName.Equals(serie.name))
                            {
                                return(true);
                            }
                        }
                        break;

                    default:
                        if (legendName.Equals(serie.name))
                        {
                            return(true);
                        }
                        break;
                    }
                }
            }
            return(false);
        }
Esempio n. 2
0
        public static Color GetNameColor(BaseChart chart, int index, string name)
        {
            Serie     destSerie     = null;
            SerieData destSerieData = null;
            var       series        = chart.series;

            for (int n = 0; n < series.list.Count; n++)
            {
                var serie = series.GetSerie(n);
                if (serie.type == SerieType.Pie || serie.type == SerieType.Radar || serie.type == SerieType.Ring ||
                    (serie.type == SerieType.Custom && chart.GetCustomSerieDataNameForColor()))
                {
                    bool found = false;
                    for (int i = 0; i < serie.data.Count; i++)
                    {
                        if (name.Equals(serie.data[i].name))
                        {
                            destSerie     = serie;
                            destSerieData = serie.data[i];
                            found         = true;
                            break;
                        }
                    }
                    if (found)
                    {
                        break;
                    }
                }
                else
                {
                    if (name.Equals(serie.name))
                    {
                        destSerie     = serie;
                        destSerieData = null;
                        break;
                    }
                }
            }
            return(SerieHelper.GetItemColor(destSerie, destSerieData, chart.theme, index, false));
        }
Esempio n. 3
0
 /// <summary>
 /// 获得所有系列名,不包含空名字。
 /// </summary>
 /// <returns></returns>
 public static void UpdateSerieNameList(BaseChart chart, ref List <string> serieNameList)
 {
     serieNameList.Clear();
     for (int n = 0; n < chart.series.list.Count; n++)
     {
         var serie = chart.series.GetSerie(n);
         if (serie.type == SerieType.Pie ||
             serie.type == SerieType.Radar ||
             serie.type == SerieType.Ring ||
             (serie.type == SerieType.Custom && chart.GetCustomSerieDataNameForColor()))
         {
             for (int i = 0; i < serie.data.Count; i++)
             {
                 if (serie.type == SerieType.Pie && serie.IsIgnoreValue(serie.data[i]))
                 {
                     continue;
                 }
                 if (string.IsNullOrEmpty(serie.data[i].name))
                 {
                     serieNameList.Add(ChartCached.IntToStr(i));
                 }
                 else if (!serieNameList.Contains(serie.data[i].name))
                 {
                     serieNameList.Add(serie.data[i].name);
                 }
             }
         }
         else
         {
             if (string.IsNullOrEmpty(serie.name))
             {
                 serieNameList.Add(ChartCached.IntToStr(n));
             }
             else if (!serieNameList.Contains(serie.name))
             {
                 serieNameList.Add(serie.name);
             }
         }
     }
 }