Created
April 12, 2016 16:27
-
-
Save kwhinnery/c0b33d43ecc10230e90a771e45c39411 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
// 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); | |
}); |
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
// 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