Populate Multi-Series (Multi-Column) Bar Chart from database using jQuery ChartJS Plugin in ASP.Net

Last Reply 2 months ago By dharmendr

Posted 2 months ago

Hi,

I have a snippet in which this person has made use of multi column bar chart using chart.js.

however I want to know that how can I use it in chart.js I want to use this snippet in my asp.net webform

The link is below:

https://codepen.io/Shokeen/pen/NpgbKg

https://codepen.io/bencarmichael/pen/XeYJXJ

The strategy which I am using right now in other charts using chart.js is metioned below and I need the required snippet in this format too.

public class OnGoingAmountToBeBilled
{
    public string[] Labels { get; set; }
    public decimal[] Datas { get; set; }
}

 

        [WebMethod]
        public static OnGoingAmountToBeBilled GetOngoingProjectAmountToBeBilled()
        {
            using (DataTable dt = Snippets.GetData(XQuery(screen, "GetOngoingProjectAmountToBeBilled"), Param("doID", MySession("doID"))))
            {
                OnGoingAmountToBeBilled chartData = new OnGoingAmountToBeBilled();
                string[] label = (dt.AsEnumerable().Select(p => p.Field<string>("ProjName"))).Distinct().ToArray();
                Decimal[] data = (dt.AsEnumerable().Select(p => p.Field<Decimal>("BillAmount"))).ToArray();

                chartData.Labels = label;
                chartData.Datas = data;

                return chartData;
            }
        }

 

This question does not have replies that have been liked.