Skip to content

Instantly share code, notes, and snippets.

@samirbr
Last active January 6, 2016 00:06
Show Gist options
  • Select an option

  • Save samirbr/677c90873f0b4917a47f to your computer and use it in GitHub Desktop.

Select an option

Save samirbr/677c90873f0b4917a47f to your computer and use it in GitHub Desktop.

Revisions

  1. samirbr revised this gist Jan 6, 2016. 1 changed file with 2 additions and 2 deletions.
    4 changes: 2 additions & 2 deletions harvest_count_month.js
    Original file line number Diff line number Diff line change
    @@ -12,10 +12,10 @@ $http.get('/nodes')
    $scope.series.push(form.name);

    $scope.data.push(form.total_harvest_by_month.map(function(monthly) {
    var month = moment(perMonth[0]).utc();
    var month = moment(monthly[0]).utc();

    if (!(month.month() in months)) {
    months[month.month()] = months.format("MMM");
    months[month.month()] = month.format("MMM");
    }

    return monthly[1];
  2. samirbr created this gist Jan 5, 2016.
    28 changes: 28 additions & 0 deletions harvest_count_month.js
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,28 @@
    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(perMonth[0]).utc();

    if (!(month.month() in months)) {
    months[month.month()] = months.format("MMM");
    }

    return monthly[1];
    }));
    });

    $scope.months = Object.keys(months).map(function(index) {
    return months[index];
    });
    });