如何使用datatable将数据绑定到highcharts? [英] How to bind data to highcharts using datatable?

查看:442
本文介绍了如何使用datatable将数据绑定到highcharts?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

您好,

我想学习高分榜。我得到了一个与公共变量绑定数据的例子,但现在我想从数据库中获取一个数据表,并将该数据表绑定到highcharts。

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.

推荐答案

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







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



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


这篇关于如何使用datatable将数据绑定到highcharts?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆