Skip to content

Instantly share code, notes, and snippets.

@kwhinnery
Created April 12, 2016 16:27
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save kwhinnery/c0b33d43ecc10230e90a771e45c39411 to your computer and use it in GitHub Desktop.
Save kwhinnery/c0b33d43ecc10230e90a771e45c39411 to your computer and use it in GitHub Desktop.
// Load user year data
$.ajax('/ga/users').then(function(data) {
// Populate raw numbers
var usersYearFormatted = humanize.numberFormat(data.usersThisYear, 0);
var usersQuarterFormatted = humanize.numberFormat(data.usersThisQuarter,
0);
$('.users-year').text(usersYearFormatted);
$('.users-quarter').text(usersQuarterFormatted);
// Populate progress bar
$quarterGoal = $('.progress.current-goal .progress-bar');
$yearGoal = $('.progress.year-goal .progress-bar');
updatePercent($quarterGoal, data.usersThisQuarter, data.goals.users.quarter
);
updatePercent($yearGoal, data.usersThisYear, data.goals.users.year);
});
// Load user year data
$.ajax('/ga/users').then(function(data) {
// Populate raw numbers
var usersYearFormatted = humanize.numberFormat(data.usersThisYear, 0);
var usersQuarterFormatted = humanize.numberFormat(data.usersThisQuarter, 0);
$('.users-year').text(usersYearFormatted);
$('.users-quarter').text(usersQuarterFormatted);
// Populate progress bar
$quarterGoal = $('.progress.current-goal .progress-bar');
$yearGoal = $('.progress.year-goal .progress-bar');
updatePercent($quarterGoal, data.usersThisQuarter,
data.goals.users.quarter);
updatePercent($yearGoal, data.usersThisYear, data.goals.users.year);
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment