diff --git a/controllers/user.js b/controllers/user.js index 7bce16c40c..3048f7e97a 100644 --- a/controllers/user.js +++ b/controllers/user.js @@ -235,10 +235,15 @@ exports.returnUser = function(req, res, next) { if (user[0]) { var user = user[0]; Challenge.find({}, null, {sort: {challengeNumber: 1}}, function (err, c) { - data = { - "1424569155": 1, - "1424519155": 1 - }; + data = {}; + progressTimestamps = user.progressTimestamps; + // dummy data to experiment with visualizations + progressTimestamps = [1417117319, 1384091493, 1367893914, 1411547157, 1366875140, 1382614404, 1374973026, 1363495510, 1372229313, 1389795294, 1393820136, 1395425437, 1383366211, 1402063449, 1368384561, 1413460738, 1390013511, 1408510076, 1395530419, 1391588683, 1410480320, 1360219531, 1367248635, 1408531181, 1374214772, 1424038529, 1387468139, 1381934158, 1409278748, 1390696161, 1415933043, 1389573689, 1395703336, 1401223291, 1375539279, 1371229698, 1371990948, 1422236826, 1363017438, 1359619855, 1364850739, 1401982108, 1381270295, 1420063854, 1406540493, 1409122251, 1360775035, 1367712723, 1395305605, 1382037418, 1378402477, 1377563090, 1398930836, 1417371909, 1377417393, 1423763002, 1357511908, 1377375961, 1388374304, 1406416407, 1399463258, 1422593990, 1383434425, 1420200570, 1379435518, 1414512582, 1416263148, 1398635260, 1381815565, 1369178539, 1378414973, 1394409827, 1398463526, 1379564971, 1385849279, 1392899666, 1367053659, 1417730793, 1400112915, 1379923357, 1417768487, 1415779985, 1416150640, 1399820237, 1370498715, 1374800622, 1363924512, 1402497668, 1400146327, 1362456746, 1394935898, 1414980963, 1413942775, 1367606840, 1387144705, 1407906392, 1417213587, 1422640891, 1414033139, 1365323522, 1424661148]; + for (i = 0; i < progressTimestamps.length; i++) { + data[progressTimestamps[i].toString()] = 1; + } + + res.render('account/show', { title: 'Camper: ', username: user.profile.username, @@ -250,7 +255,8 @@ exports.returnUser = function(req, res, next) { twitterHandle: user.profile.twitterHandle, bio: user.profile.bio, picture: user.profile.picture, - points: user.points, + progressTimestamps: req.user.progressTimestamps, + points: user.progressTimestamps, website1Link: user.portfolio.website1Link, website1Title: user.portfolio.website1Title, website1Image: user.portfolio.website1Image, diff --git a/public/css/main.less b/public/css/main.less index a43896dec7..fd76f5a891 100644 --- a/public/css/main.less +++ b/public/css/main.less @@ -734,6 +734,11 @@ iframe.iphone { } +#cal-heatmap { + margin: 0 auto; + background-color: #fefefe; +} + //uncomment this to see the dimensions of all elements outlined in red //* { // border-color: red; diff --git a/views/account/show.jade b/views/account/show.jade index b998729f08..43b59ee3f1 100644 --- a/views/account/show.jade +++ b/views/account/show.jade @@ -105,19 +105,21 @@ block content .col-xs-12 - .embed-responsive.embed-responsive-16by9 - #cal-heatmap + #cal-heatmap script. var cal = new CalHeatMap(); var calendar = !{JSON.stringify(calender)}; - console.log(calendar); cal.init({ itemSelector: "#cal-heatmap", domain: "month", subDomain: "day", data: calendar, - range: 10, - start: new Date(2015, 0), - itemName: "", - legend: [5, 10, 15, 20, 25, 30] + cellSize: 15, + cellRadius: 3, + cellPadding: 2, + tooltip: true, + range: 4, + start: new Date().setDate(new Date().getDate() - 90), + legendColors: ["#cccccc", "#215f1e"], + legend: [1, 2, 3] }); \ No newline at end of file