Skip to content

Instantly share code, notes, and snippets.

@kwhinnery
Created Apr 12, 2016
Embed
What would you like to do?
// 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