ASP.Net Chart Error: Y values cannot be data bound to the string object. Parameter name: yValues

Last Reply one year ago By pandeyism

Posted one year ago


I follow this example: 

Create ASP.Net Chart Control from Database using C# and VB.Net Example

But, in my case I want to bind to chart 2 string[],not string[] and int[]. 

I think I should modify this line:

Chart1.Series[0].Points.DataBindXY(x, y);

How can I do this?

string[] x = new string[dt.Rows.Count];
string[] y = new string[dt.Rows.Count];
for (int i = 0; i < dt.Rows.Count; i++)
    x[i] = dt.Rows[i][0].ToString();
    y[i] = dt.Rows[i][1].ToString();