Click here to Skip to main content
15,924,193 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I was able to load an excel file in an asp.net project.
I now want to create a dynamic chart, that will graph any column, based on my selection on 2 combobox.
I want to be able to graph both columns in a chart and, for the chart to update, based on my combobox selection.
I tried some code but couldn't get it to work, since this is the first time I use charts, and asp.net.
I need the column headers to appear in the 2 combobox.
Please help.
Thanks.

What I have tried:

C#
protected void cb1_SelectedIndexChanged(object sender, EventArgs e)
        {
            
            System.Text.StringBuilder row1 = new System.Text.StringBuilder();
            System.Text.StringBuilder row2 = new System.Text.StringBuilder();
            // Classic version :-)
            string[] data=new string[GridView1.Rows.Count - 1];
            for (int row=1;row<=GridView1.Rows.Count;row++)
            {
                row1.Append(Convert.ToString(GridView1.Rows[row].Cells[0].ToString()) + ";");
                row2.Append(Convert.ToString(GridView1.Rows[row].Cells[0].ToString()) + ";");
            }
                        
            Chart1.Series[0].XValueMember = row1.;
            Chart1.Series[1].YValueMembers = GridView1.Columns[cb2.SelectedIndex].DataPropertyName;
            Chart1.DataSource = GridView1.DataSource;
        }
Posted
Comments
Karthik_Mahalingam 5-Dec-17 23:39pm    
is this fixed?

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900