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

Last Reply 4 months ago By pandeyism

Posted 5 months ago

Hi,

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();
}

 

You are viewing reply posted by: pandeyism 4 months ago.