Click here to Skip to main content
15,867,834 members
Please Sign up or sign in to vote.
1.44/5 (2 votes)
See more:
Hello,
I want to learn high charts. I got a example of data binding with public variables, but now i want to get a datatable from database and bind that datatable to highcharts.
Posted

1 solution

C#
SqlDataReader rdr = cmd.ExecuteReader();
            Object[] chartValues = new Object[9];
            string ss = "";
            int i = 0;
            while (rdr.Read())
            {
                //chartValues[(int32)rdr.GetValue(0) - 1] = rdr.GetValue(1);
                chartValues[i] = rdr.GetValue(1);
                i++;
            }
            rdr.Close();


C#
series.Add(new Serie { data =  chartValues });



        //bind data to chart
        hcLinechart.DataSource = series;
        hcLinechart.DataBind();
 
Share this answer
 

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