1

How to create multi series ASP.net chart dynamically.

1 Answer 1

0
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.
    }
}

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.