I am working on a solution to populate empty values when data is not available for specific months. You can view my progress on Plunker here: http://plnkr.co/edit/f0IklkUfX8tkRZrn2enx?p=preview
$scope.year = [
{"month":"mar", "val":"23"},
{"month":"feb", "val":"45"},
{"month":"jan", "val":"56"}
];
var total = ["jan", "feb", "mar", "apr", "may", "jun", "aug", "sep", "oct", "nov", "dec"];
for(var i=0; i<total.length; i++){
if($scope.year[i].month === undefined){ //Implement logic to identify missing month.
$scope.year.push(
{
"month":total[i],
"val":"0"
})
}
}
I've created an array of default total months items to compare each month with the expected object. If a month is missing in the expected object, I need to add an empty item or set its value to "0" directly in the expected object.