Chartjs-How to create dataset in chart.js dynamically using array?

0👍

I don’t really know why you would take glc = mdistid[i] while array mdistid is clearly empty. That’s why your selector $('#qty1' + glc) fail.

Also, you can use string concatenation on jQuery selector, e.g.: distdata[j] = $('#qty' + mth + glc).val();.

You could provide some data, and we can’t guess what’s possibly inside marr and mathlen.

0👍

I figured out that the scope of array distdata = [] was causing issues. Got placed it before the inner loop and it works.

Leave a comment