开发者

Dynamically create Asp Chart multi series

开发者 https://www.devze.com 2022-12-23 13:27 出处:网络
开发者_JAVA技巧How to create multi series ASP.net chart dynamically.private void BindChart(DataTable dt)

开发者_JAVA技巧How to create multi series ASP.net chart dynamically.


private void BindChart(DataTable dt)
{
    dt.DefaultView.Sort = "Category Asc";

    DataTable dtSorted = dt.DefaultView.ToTable();

    string sCategoryName = string.Empty;
    string sOldCategoryName = string.Empty;
    for (int i = 0; i < dtSorted.Rows.Count; i++)
    {
        sCategoryName = dtSorted.Rows[i]["Category"].ToString();
        if (sCategoryName != sOldCategoryName)
        {
            // Your logic here to bind the category in chart
            sOldCategoryName = sCategoryName;
        }
        // Bind other details (description etc) from the table.
    }
}
0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号