Skip to content

Commit a00caac

Browse files
author
kuivenhoven1
committed
almost finished nested pie chart. added slideshow of galley images of uv-cdat to homepage
1 parent d3d72e6 commit a00caac

File tree

20 files changed

+810
-109
lines changed

20 files changed

+810
-109
lines changed

stats/urls.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66

77
urlpatterns = patterns('stats.views',
88
url(r'^session/?$', 'get_session'),
9+
url(r'^doesthis/?$', 'doesthis'),
910

1011
# /log/add/
1112
url(r'^add/?$', 'log_event'),

stats/views.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -128,6 +128,8 @@ def get_session(request):
128128
session = retrieve_session(request.GET, request)
129129
return JsonResponse({"token": str(session.token)})
130130

131+
def doesthis(request):
132+
return render_to_response('doesthis.html', {}, context_instance=RequestContext(request))
131133

132134
# exempt logEvent from CSRF protection, or programs will not be able to
133135
# submit their statistics!

statsPage/static/js/base/social.js

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
$(function () {
2+
var all_classes = "";
3+
var timer = undefined;
4+
$.each($('li', '.social-class'), function (index, element) {
5+
all_classes += " btn-" + $(element).data("code");
6+
});
7+
$('li', '.social-class').mouseenter(function () {
8+
var icon_name = $(this).data("code");
9+
if ($(this).data("icon")) {
10+
icon_name = $(this).data("icon");
11+
}
12+
var icon = "<i class='fa fa-" + icon_name + "'></i>";
13+
$('.btn-social', '.social-sizes').html(icon + "Sign in with " + $(this).data("name"));
14+
$('.btn-social-icon', '.social-sizes').html(icon);
15+
$('.btn', '.social-sizes').removeClass(all_classes);
16+
$('.btn', '.social-sizes').addClass("btn-" + $(this).data('code'));
17+
});
18+
$($('li', '.social-class')[Math.floor($('li', '.social-class').length * Math.random())]).mouseenter();
19+
});
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
/*$(document).ready(function(){*/
2+
3+
4+
5+
6+
//});
7+
8+
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
/*function myFunction(h) {
2+
document.getElementById('hide_cities' + h).style.visibility="hidden";
3+
}*/
4+
5+
function myStuff(h) {
6+
alert(h);
7+
}
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
$(document).ready(function(){
2+
$('[data-toggle="popover"]').popover();
3+
});
4+
5+
$(document).ready(function(){
6+
$('[data-toggle="tooltip"]').tooltip({
7+
animated : 'fade',
8+
placement : 'bottom',
9+
container: 'body'
10+
});
11+
});
Lines changed: 174 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,174 @@
1+
$(document).ready(function() {
2+
var stuff = document.getElementById('coords').innerHTML;
3+
var months = document.getElementById('months').innerHTML;
4+
var okay = $.makeArray(months);
5+
var monthdata = document.getElementById('monthdata').innerHTML;
6+
//monthdata = $.makeArray(monthdata);
7+
var copy = months;
8+
copy = copy.split(",");
9+
console.log(copy);
10+
console.log(okay);
11+
12+
var parsedTest = JSON.parse(months);
13+
var sparsedTest = JSON.parse(monthdata);
14+
console.log(parsedTest);
15+
console.log(sparsedTest);
16+
//console.log(stuff);
17+
//console.log(typeof(months));
18+
//console.log(monthdata);
19+
20+
var total = [];
21+
for(var i = 0; i < parsedTest.length; i++)
22+
{
23+
//total.push(months[i]);
24+
var nested = [];
25+
nested.push(parsedTest[i], sparsedTest[i]);
26+
total.push(nested);
27+
//total.push(parsedTest[i], sparsedTest[i]);
28+
}
29+
console.log(total[0][0]);
30+
var max = Math.max.apply(Math,sparsedTest);
31+
console.log(max);
32+
33+
var all_users = 0;
34+
for(var j=0; j<total.length; j++)
35+
{
36+
all_users += total[j][1];
37+
}
38+
//});
39+
40+
41+
//$(document).ready(function() {
42+
var pie = new d3pie("pieChart", {
43+
/*"header": {
44+
"title": {
45+
"text": "Percentage of session start dates by month",
46+
"fontSize": 24,
47+
"font": "open sans"
48+
},
49+
"subtitle": {
50+
"text": "Note: if a month is not displayed, it means there were 0 start date visits for that month.",
51+
"color": "#999999",
52+
"fontSize": 12,
53+
"font": "open sans"
54+
},
55+
"titleSubtitlePadding": 9
56+
},*/
57+
"footer": {
58+
"text": "Out of a total of " + all_users + " active user sessions.",
59+
"color": "#000000",
60+
"fontSize": 17,
61+
"location": "bottom-center",/*
62+
"font": "open sans",
63+
"location": "bottom-left"*/
64+
},
65+
"size": {
66+
"canvasWidth": 1000,
67+
"pieOuterRadius": "100%"
68+
},
69+
"data": {
70+
"content": [
71+
{
72+
"label": "January, " + total[0][1] + " active users",
73+
"value": total[0][1],
74+
"color": "#c0dfd9"
75+
},
76+
{
77+
"label": "February, " + total[1][1] + " active users",
78+
"value": total[1][1],
79+
"color": "#e9ece5"
80+
},
81+
{
82+
"label": "March, " + total[2][1] + " active users",
83+
"value": total[2][1],
84+
"color": "#b3c2bf"
85+
},
86+
{
87+
"label": "April, " + total[3][1] + " active users",
88+
"value": total[3][1],
89+
"color": "#3b3a36"
90+
},
91+
{
92+
"label": "May, " + total[4][1] + " active users",
93+
"value": total[4][1],
94+
"color": "#edd9c0"
95+
},
96+
{
97+
"label": "June, " + total[5][1] + " active users",
98+
"value": total[5][1],
99+
"color": "#c9d8c5"
100+
},
101+
{
102+
"label": "July, " + total[6][1] + " active users",
103+
"value": total[6][1],
104+
"color": "#a8b6bf"
105+
},
106+
{
107+
"label": "August, " + total[7][1] + " active users",
108+
"value": total[7][1],
109+
"color": "#7d4627"
110+
},
111+
{
112+
"label": "September, " + total[8][1] + " active users",
113+
"value": total[8][1],
114+
"color": "#e8edf3"
115+
},
116+
{
117+
"label": "October, " + total[9][1] + " active users",
118+
"value": total[9][1],
119+
"color": "#e6cf8b"
120+
},
121+
{
122+
"label": "November, " + total[10][1] + " active users",
123+
"value": total[10][1],
124+
"color": "#b56969"
125+
},
126+
{
127+
"label": "December, " + total[11][1] + " active users",
128+
"value": total[11][1],
129+
"color": "#22264b"
130+
}
131+
]
132+
},
133+
"labels": {
134+
"outer": {
135+
"pieDistance": 32
136+
},
137+
"inner": {
138+
"hideWhenLessThanPercentage": 3
139+
},
140+
"mainLabel": {
141+
"fontSize": 15
142+
},
143+
"percentage": {
144+
"color": "#ffffff",
145+
"decimalPlaces": 2
146+
},
147+
"value": {
148+
"color": "#adadad",
149+
"fontSize": 15
150+
},
151+
"lines": {
152+
"enabled": true
153+
},
154+
"truncation": {
155+
"enabled": true
156+
}
157+
},
158+
"effects": {
159+
"pullOutSegmentOnClick": {
160+
"effect": "linear",
161+
"speed": 400,
162+
"size": 8
163+
}
164+
},
165+
"misc": {
166+
"gradient": {
167+
"enabled": true,
168+
"percentage": 100
169+
}
170+
}
171+
});
172+
});
173+
174+
Lines changed: 90 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,90 @@
1+
function loadpiechart(thiso){
2+
google.charts.load('current', {'packages':['corechart']});
3+
google.charts.setOnLoadCallback(drawChart);
4+
5+
function drawChart() {
6+
7+
var okay = thiso;
8+
var all_it = new Array();
9+
var jan = 0;
10+
var feb = 0;
11+
var march = 0;
12+
var april = 0;
13+
var may = 0;
14+
var june = 0;
15+
var july = 0;
16+
var aug = 0;
17+
var sept = 0;
18+
var oct = 0;
19+
var nov = 0;
20+
var dec = 0;
21+
22+
/*for(var j = 0; j < all_data.length; j+=2) {
23+
all_it.push(all_data[j];
24+
} */
25+
26+
for(var i = 0; i < okay.length; i++) {
27+
if(okay[i] == 1){
28+
jan += 1;
29+
}
30+
if(okay[i] == 2){
31+
feb += 1;
32+
}
33+
if(okay[i] == 3){
34+
march += 1;
35+
}
36+
if(okay[i] == 4){
37+
april += 1;
38+
}
39+
if(okay[i] == 5){
40+
may += 1;
41+
}
42+
if(okay[i] == 6){
43+
june += 1;
44+
}
45+
if(okay[i] == 7){
46+
july += 1;
47+
}
48+
if(okay[i] == 8){
49+
aug += 1;
50+
}
51+
if(okay[i] == 9){
52+
sept += 1;
53+
}
54+
if(okay[i] == 10){
55+
oct += 1;
56+
}
57+
if(okay[i] == 11){
58+
nov += 1;
59+
}
60+
if(okay[i] == 12){
61+
dec += 1;
62+
}
63+
}
64+
65+
alert("this stuff: " + sept + " " + oct + " " + nov + " " + dec);
66+
67+
var data = google.visualization.arrayToDataTable([
68+
['Month', 'Number of Sessions'],
69+
['January', Number(jan)],
70+
['February', Number(feb)],
71+
['March', Number(march)],
72+
['April', Number(april)],
73+
['May', Number(may)],
74+
['June', Number(june)],
75+
['July', Number(july)],
76+
['August', Number(aug)],
77+
['September', Number(sept)],
78+
['October', Number(oct)],
79+
['November', Number(nov)],
80+
['December', Number(dec)]
81+
]);
82+
83+
var options = {
84+
title: 'Number of sessions for 2016'
85+
};
86+
87+
var chart = new google.visualization.PieChart(document.getElementById('piechart'));
88+
chart.draw(data, options);
89+
}
90+
}

0 commit comments

Comments
 (0)