1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59
   | Chart1.DataSource = dtb;             string[] strcolor = new string[20];             strcolor[0] = "220, 224, 64, 10";             strcolor[1] = "220, 252, 180, 65";             strcolor[2] = "220, 159, 100, 100";             strcolor[3] = "220, 5, 100, 146";             strcolor[4] = "91,42,0";             strcolor[5] = "19,211,188";             strcolor[6] = "0,93,70";             strcolor[7] = "185,147,240";             strcolor[8] = "194,211,252";             strcolor[9] = "49,0,93";             strcolor[10] = "245,111,5";             strcolor[11] = "203,72,178";             strcolor[12] = "93,93,0";             strcolor[13] = "165,165,147";             strcolor[14] = "124,201,15";             strcolor[15] = "14,112,201";             strcolor[16] = "0,59,93";             strcolor[17] = "5,18,108";             strcolor[18] = "245,15,54";             strcolor[19] = "121,129,234";             Chart1.Series.Clear();             for (int i = 0; i < dt.Rows.Count; i++)             {                 Chart1.Series.Add(i.ToString());                 Chart1.Series[i.ToString()].ChartType = SeriesChartType.StackedBar;                 Chart1.Series[i.ToString()].IsXValueIndexed = true;                 Chart1.Series[i.ToString()].XValueMember = "Customer";                 Chart1.Series[i.ToString()].YValueMembers = "StickCarQutity" + (i + 1);                 Chart1.Series[i.ToString()].LegendText = dt.Rows[i]["level"].ToString();                 Chart1.Series[i.ToString()].BorderColor = Color.FromArgb(180, 26, 59, 105);                 Chart1.Series[i.ToString()].IsValueShownAsLabel = true;                 if (i < 4)                 {                     string[] number = strcolor[i].ToString().Split(new Char[] { ',' });                     int alpha = int.Parse(number[0].ToString());                     int red = int.Parse(number[1].ToString());                     int green = int.Parse(number[2].ToString());                     int blue = int.Parse(number[3].ToString());                     Chart1.Series[i.ToString()].Color = Color.FromArgb(alpha, red, green, blue);                 }                 else                 {                     if(3<i&&i<20)                     {                         string[] number = strcolor[i].ToString().Split(new Char[] { ',' });                         int red = int.Parse(number[0].ToString());                         int green = int.Parse(number[1].ToString());                         int blue = int.Parse(number[2].ToString());                         Chart1.Series[i.ToString()].Color = Color.FromArgb(red, green, blue);                     }                     else                     {                                          }                 }             }             Chart1.DataBind();
   |