How to add multiple series to the dynamic chart
<p>I put my all code and trying to create a dynamic chart which series comes from database,i looped through listitem collection and trying to populate series and add to the chart.However even i loop through ("@Plant2", DT.Rows[i][0].ToString()); Plant2 and trying to populate multiple series with </p>

<p>plantseries = DT.Rows[i][0].ToString();</p>

<p>Chart1.Series.Add(plantseries);</p>

<p>and then give series the X and Y valuemembers.Finally i can not get all the series in my chart,result indicates last same values for all items in the loop,like my code overwrites the last value onto the same series name.Please help me,i am lost.              </p>

<pre><code>            string[] lstBox = HiddenField2.Value.Split(seperator, StringSplitOptions.RemoveEmptyEntries);
            ListItemCollection lstItemCollection = new ListItemCollection();

            for (int i = 0; i &lt; lstBox.Length; i++) 
              {
                  lstItemCollection.Add(new ListItem(lstBox[i])); 
              }

            DataTable DT = new DataTable();
            DT.Columns.Add("Plant");
            foreach (ListItem item in lstItemCollection) 
            { 
                DataRow dr = DT.NewRow();            
                dr["Plant"] = item.Value; 
                DT.Rows.Add(dr); 
            } 


            String plantseries = "";
            Chart1.Legends.Add("Plants");
            LegendItem legendItem = new LegendItem();


        for (int i = 0; i &lt; lstItemCollection.Count; i++)
        {
            DataTable monthlychart = new DataTable();
            if (cnn.State == ConnectionState.Closed)
            {
                cnn.Open();
                SqlCommand cmd1 = new SqlCommand("prc_Chart_individual_plant", cnn);
                cmd1.CommandType = System.Data.CommandType.StoredProcedure;
                cmd1.Parameters.AddWithValue("@Plant", strPlants.ToString());
                cmd1.Parameters.AddWithValue("@Configuration", strconfig.ToString());
                cmd1.Parameters.AddWithValue("@Startdate", dtstart);
                cmd1.Parameters.AddWithValue("@Enddate", dtend);
                cmd1.Parameters.AddWithValue("@Plant2", DT.Rows[i][0].ToString());
                SqlDataAdapter adapt1 = new SqlDataAdapter(cmd1);
                adapt1.Fill(monthlychart);
                Chart1.DataSource = monthlychart;
                cnn.Close();
            }


            plantseries = DT.Rows[i][0].ToString();
            Chart1.Series.Add(plantseries);
            Chart1.Series[plantseries].XValueMember = Convert.ToString(monthlychart.Columns[4]);
            Chart1.Series[plantseries].YValueMembers = Convert.ToString(monthlychart.Columns[8]);                 
            Chart1.DataBind();

            legendItem.Name = plantseries;                
            legendItem.BorderWidth = 4;
            legendItem.ShadowOffset = 1;

            Random random = new Random();
            Color c = Color.FromArgb(random.Next(0, 255), random.Next(0, 255), random.Next(0, 255));
            legendItem.Color = c;

            Chart1.ChartAreas[0].AxisX.LabelStyle.Format = "M.yy";


            Chart1.Series[plantseries].IsVisibleInLegend = true;
            Chart1.Series[plantseries].IsValueShownAsLabel = true;
            Chart1.Series[plantseries].ToolTip = "Data Point Y Value: #VALY{G}";
         }
</code></pre>
