javascript - combine and merge two array into set of arrays for Highchart Pie -
i have set of 2 arrays this:
["arrear bonus","hra","rent",....] [58880,25211,21355,12341,.....]
and in highcharts pie
need show series this:
$(...).highcharts({ .... .... series: [ ["arrear bonus",5880], ["hra",25211], ["rent",21355], ] });
so need create chunk of arrays 2 arrays set; tried this:
var expense_name = amounts.expense_name; var expense_amount = amounts.expense_amt; var arr3 = {}; $.each(expense_name, function(i, value){ arr3[value] = expense_amount[i]; });
but got this:
{ arrear bonus: 12000,hra: 121331,rent: 17744...}
how can achieve result:
[ ["arrear bonus",5880], ["hra",25211], ["rent",21355], ]
set arr3
var array , push elements :
var expense_name = amounts.expense_name; var expense_amount = amounts.expense_amt; var arr3 = []; $.each(expense_name, function(i, value){ arr3.push([value,expense_amount[i]]); });
Comments
Post a Comment