Skip to content

Commit 219cbfe

Browse files
committed
Add attendee statistics
1 parent 4cf41d4 commit 219cbfe

5 files changed

Lines changed: 9739 additions & 9 deletions

File tree

src/main/java/com/devnexus/ting/web/config/WebConfig.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -325,6 +325,7 @@ public WroModel create() {
325325
.addResource(Resource.create("/assets/js/jquery.easing.min.js", ResourceType.JS))
326326
.addResource(Resource.create("/assets/js/jquery-plugins/jquery.succinct.js", ResourceType.JS))
327327
.addResource(Resource.create("/assets/js/bootstrap.min.js", ResourceType.JS))
328+
.addResource(Resource.create("/assets/js/d3.js", ResourceType.JS))
328329
.addResource(Resource.create("/assets/js/other/masonry.pkgd.js", ResourceType.JS))
329330
.addResource(Resource.create("/assets/js/jquery-plugins/jquery.fittext.js", ResourceType.JS))
330331
.addResource(Resource.create("/assets/js/other/scrollr.js", ResourceType.JS))

src/main/webapp/WEB-INF/jsp/index.jsp

Lines changed: 119 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,34 @@
3434
<script src="https://oss.maxcdn.com/libs/html5shiv/3.7.0/html5shiv.js"></script>
3535
<script src="https://oss.maxcdn.com/libs/respond.js/1.3.0/respond.min.js"></script>
3636
<![endif]-->
37+
<style type="text/css">
38+
#chart-tooltip {
39+
position: absolute;
40+
width: 400px;
41+
height: auto;
42+
padding: 5px;
43+
z-index: 9999999;
44+
background-color: #ffffff;
45+
-webkit-border-radius: 4px;
46+
-moz-border-radius: 4px;
47+
border-radius: 4px;
48+
-webkit-box-shadow: 4px 4px 10px rgba(0, 0, 0, 0.2);
49+
-moz-box-shadow: 4px 4px 10px rgba(0, 0, 0, 0.2);
50+
box-shadow: 4px 4px 10px rgba(0, 0, 0, 0.2);
51+
pointer-events: none;
52+
}
3753
54+
#chart-tooltip.hidden {
55+
display: none;
56+
}
57+
58+
#chart-tooltip p {
59+
margin: 0;
60+
font-family: sans-serif;
61+
font-size: 16px;
62+
line-height: 20px;
63+
}
64+
</style>
3865
</head>
3966
<body>
4067
<c:url var="homeUrl" value="${baseSiteUrl}/index"/>
@@ -78,7 +105,11 @@
78105
</ul>
79106
</div>
80107
</nav>
81-
108+
<div id="chart-tooltip" class="hidden">
109+
<p><strong><span id="value">123</span> Attendees</strong></p>
110+
<p><span id="session-title">title</span></p>
111+
<p><span id="session-speaker">speaker</span></p>
112+
</div>
82113
<!-- Intro Header -->
83114
<section id="index--intro" class="module parallax index--parallax-1">
84115
<div class="container header">
@@ -102,11 +133,11 @@
102133
<div class="col-md-10 col-md-offset-1">
103134
<div id="tagline">Join the <span>&lt;dev/&gt;</span>olution.</div>
104135
</div>
105-
<div class="col-md-6 col-md-offset-3">
106-
<p class="lead">Welcome to the premier conference for professional software developers!
107-
It&rsquo;s show-time! Let&rsquo;s rock and have some fun!</p>
108-
<p class="lead text-center"><strong>The Wifi credentials are:</strong></p>
109-
<p class="lead text-center">Network: <strong>devnexus2015</strong> | Password: <strong>awesome</strong></p>
136+
<div class="col-md-8 col-md-offset-2">
137+
<p class="lead">THANK YOU ALL for attending the show!!
138+
Grab the <a href="https://github.com/devnexus/devnexus2015" target="_blank">presentation slides</a>
139+
from GitHub or check out the download links under <a href="${ctx}/s/presentations" target="_blank">presentations</a>.
140+
The videos of the sessions will be posted via <a href="http://www.dzone.com/" target="_blank">DZone</a> within a couple of weeks.</p>
110141
</div>
111142
</div>
112143
<div class="row" style="margin-bottom: 20px;">
@@ -125,8 +156,7 @@
125156
</div>
126157
</div>
127158
<div class="row">
128-
<div class="col-sm-6 col-sm-offset-3 text-center">
129-
<a href="${ctx}/s/evaluations/add" class="btn btn-primary registerButton">Send us Evaluations</a>
159+
<div id="d3chart" class="col-md-10 col-md-offset-1">
130160
</div>
131161
</div>
132162
</div>
@@ -455,6 +485,87 @@
455485
});
456486
457487
$("#tagline").fitText().fitText(1.05);
488+
489+
var container = d3.select("#d3chart")
490+
491+
var width = $("#d3chart").width();
492+
var height = 120
493+
494+
var svg = container.append("svg");
495+
svg.attr("height", height);
496+
svg.attr("width", width);
497+
svg.attr("viewBox", "0 0 " + width + " " + height);
498+
svg.attr("perserveAspectRatio", "xMinYMid");
499+
500+
$(window).on("resize", function() {
501+
svg.attr("width", $("#d3chart").width());
502+
svg.attr("height", 120);
503+
});
504+
505+
var barWidth = 4;
506+
507+
function processData(data) {
508+
509+
var maxValue = d3.max(data, function(el) {
510+
return parseInt(el.attendees)
511+
});
512+
var minValue = d3.min(data, function(el) {
513+
return parseInt(el.attendees)
514+
});
515+
var meanValue = d3.mean(data, function(el) {
516+
return parseInt(el.attendees)
517+
});
518+
519+
var xScale = d3.scale.linear().domain([0, data.length]).range([0, width]);
520+
var yScale = d3.scale.linear().domain([0, maxValue]).range([0, height]);
521+
522+
svg.selectAll('rect').data(data).enter()
523+
.append('rect')
524+
.attr('width', barWidth)
525+
.attr('height', function(d) {
526+
return yScale(d.attendees);
527+
})
528+
.attr("x", function(d,i) {return xScale(i)})
529+
.attr("y", function(d,i) {return height-yScale(d.attendees)})
530+
.style("fill"function(d,i) {return d.color})
531+
532+
.on("mouseover", function(d) {
533+
d3.select(this).style("fill", "orange");
534+
d3.select("#chart-tooltip")
535+
.style("left", $('#d3chart').offset().left + ($('#d3chart').width() / 2) - ($('#chart-tooltip').width() / 2)+ "px")
536+
.style("top", $('#d3chart').offset().top + "px")
537+
538+
d3.select("#value").text(d.attendees);
539+
d3.select("#session-title").text(d.session_title);
540+
d3.select("#session-speaker").text(d.speaker);
541+
d3.select("#chart-tooltip")
542+
.style("opacity", 0)
543+
.classed("hidden", false)
544+
.transition()
545+
.duration(250)
546+
.style("opacity", 1);
547+
})
548+
.on("mouseout", function(d) {
549+
d3.select("#chart-tooltip")
550+
.transition()
551+
.duration(250)
552+
.style("opacity", 0)
553+
d3.select(this)
554+
.transition()
555+
.duration(250)
556+
.style("fill", function(d,i) {return d.color});
557+
})
558+
.style("opacity"1)
559+
.append("title").text(function(d) {
560+
return d.session_title + ': ' + d.attendees + ' attendees.';
561+
});
562+
563+
}
564+
565+
d3.csv('${ctx}/static/2015/devnexus-stats.csv', function(data) {
566+
processData(data);
567+
});
568+
458569
});
459570
460571
</script>

src/main/webapp/WEB-INF/jsp/schedule.jsp

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -216,7 +216,12 @@
216216
resizeScheduleItems();
217217
}
218218
219-
var s = skrollr.init({forceHeight: false});
219+
var s = skrollr.init({
220+
forceHeight: false,
221+
mobileCheck: function() {
222+
return false;
223+
}
224+
});
220225
});
221226
</script>
222227
</content>

0 commit comments

Comments
 (0)