Last active
January 6, 2016 00:06
-
-
Save samirbr/677c90873f0b4917a47f to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
moment.locale('pt-BR'); | |
$scope.months = []; | |
$scope.series = []; | |
$scope.data = []; | |
$http.get('/nodes') | |
.then(function(response) { | |
var months = {}; | |
response.data.forEach(function(form) { | |
$scope.series.push(form.name); | |
$scope.data.push(form.total_harvest_by_month.map(function(monthly) { | |
var month = moment(monthly[0]).utc(); | |
if (!(month.month() in months)) { | |
months[month.month()] = month.format("MMM"); | |
} | |
return monthly[1]; | |
})); | |
}); | |
$scope.months = Object.keys(months).map(function(index) { | |
return months[index]; | |
}); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment