var list = [{
group: '111',
value: 'b',
order: 2
},
{
group: '222',
value: 'b',
order: 1
},
{
group: '111',
value: 'a',
order: 5
},
{
group: '222',
value: 'a',
order: 3
},
{
group: '111',
value: 'a',
order: 4
},
{
group: '222',
value: 'a',
order: 3
},
{
group: '111',
value: 'a',
order: 7
}];
var chartlist = [];
//console.log(JSON.stringify(chartlist));
/*
for (var item of list) {
if (!chartlist[item.group]) {
chartlist[item.group] = []
}
chartlist[item.group].push(item);
}
*/
var groupName = [];
for (var item of list) {
if(groupName.indexOf(item.group)==-1){
groupName.push(item.group)
}
}
console.log(groupName);
for(var itemname of groupName){
var array = [];
for(var item1 of list){
if(item1.group == itemname){
array.push(item1)
}
}
chartlist.push(array)
}
console.log(JSON.stringify(chartlist));
//console.log(JSON.stringify(chartlist));
for (var row of Object.keys(chartlist)) {
chartlist[row] = _.sortBy(chartlist[row], "order");
}
console.log(JSON.stringify(chartlist));
//document.write(JSON.stringify(chartlist));
console