string[] groups = new string[5]; groups[0] = "MD"; groups[1] = "SR"; groups[2] = "TS"; groups[3] = "WS"; System.Drawing.Color[] clrs = new System.Drawing.Color[5]; clrs[0] = System.Drawing.Color.Red; clrs[1] = System.Drawing.Color.Green; clrs[2] = System.Drawing.Color.MediumPurple; clrs[3] = System.Drawing.Color.Blue; clrs[4] = System.Drawing.Color.Orange; Chart1.ChartAreas["ChartArea1"].AxisX.Minimum = 0; Chart1.ChartAreas["ChartArea1"].AxisX.Maximum = 96; Chart1.ChartAreas["ChartArea1"].AxisX.Interval = 1; Chart1.ChartAreas["ChartArea1"].AxisY.Minimum = 0; Chart1.ChartAreas["ChartArea1"].AxisY.Maximum = 400; Chart1.ChartAreas["ChartArea1"].AxisY.Interval = 50; for (int cnt = 0; cnt < 4; cnt++) { com2.CommandText = ""; com2.CommandText = "SELECT left(convert(varchar,Date,106),6) + char(10) as Date, occupancy FROM occupancy_projection WHERE specialtygroup = '" + groups[cnt] + "' order by convert(date,Date)"; SqlDataReader reader = com2.ExecuteReader(); Series aSeries = new Series(); aSeries.Name = groups[cnt]; Chart1.Series.Add(aSeries[cnt]); Chart1.Series[cnt].ChartType = SeriesChartType.Line; Chart1.Series[cnt].BorderWidth = 2; Chart1.Series[cnt].MarkerStyle = MarkerStyle.Circle; Chart1.Series[cnt].XValueMember = "Date"; Chart1.Series[cnt].YValueMembers = "occupancy"; Chart1.Series[cnt].Color = clrs[cnt]; //Chart1.Series[cnt].Legend = "Legend1"; Chart1.DataSource = reader; Chart1.DataBind(); reader.Close(); } com.Dispose(); con.Close(); }
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)