-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.html
141 lines (120 loc) · 3.58 KB
/
index.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
<html>
<head>
<meta http-equiv="Content-Type" content="text/html;charset=utf-8">
<title>Data Viz</title>
<script src="d3.min.js" charset="utf-8"></script>
<script type="text/javascript" src="cal-heatmap.min.js"></script>
<script src="//ajax.googleapis.com/ajax/libs/jquery/1.11.0/jquery.min.js"></script>
<link href="cal-heatmap.css" rel="stylesheet">
<link rel="shortcut icon" href="favicon.ico">
</head>
<body>
<p id="select">SELECT SYMPTOM</p>
<button type="button" id="pain" onClick="displayPain() && location.reload()">PAIN</button>
<button type="button" id="fatigue" onClick="displayFatigue() && location.reload()">FATIGUE</button>
<button type="button" id="mobility" onClick="displayMobility() && location.reload()">MOBILITY</button>
<button type="button" id="brainfog" onClick="displayBrainFog() && location.reload()">BRAINFOG</button>
<p id="caltitle"></p>
<div id="cal2"></div>
<script type="text/javascript">
$(document).ready(function(){
$("#pain").click(function(){
$('#caltitle').html('Pain Selected');
});
$("#fatigue").click(function(){
$('#caltitle').html('Fatigue Selected');
});
$("#mobility").click(function(){
$('#caltitle').html('Mobility Selected');
});
$("#brainfog").click(function(){
$('#caltitle').html('Brainfog Selected');
});
});
var text = document.getElementById("cal2");
// This checks for mobile
if( screen.width <= 500) {
var calendar = new CalHeatMap();
calendar.init({
verticalOrientation: true,
data: "",
dataType: "json",
itemSelector: "#cal2",
start: new Date(2013, 11),
range :3,
id : "graph_c",
domain: "month",
subDomain: "x_day",
subDomainTextFormat: "%a, %d",
domainGutter: 10,
cellSize:75,
cellPadding: 3,
label: {
position: "top"
} ,
itemName: ["level", "level"],
weekStartOnMonday: false,
displayLegend: false,
legend: [-1,0,1, 2, 3,4], // Custom threshold for the scale
legendCellSize: 30
});
}
else {
var calendar = new CalHeatMap();
calendar.init({
data: "",
dataType: "json",
itemSelector: "#cal2",
start: new Date(2013, 11),
range :3,
id : "graph_c",
domain: "month",
subDomain: "x_day",
subDomainTextFormat: "%a, %d",
domainGutter: 20,
cellSize:55,
label: {
position: "top"
} ,
itemName: ["level", "level"],
weekStartOnMonday: false,
displayLegend: false,
legend: [-1,0,1, 2, 3,4], // Custom threshold for the scale
legendCellSize: 30
});
}
function displayViz(sel){
var value = sel.options[sel.selectedIndex].value;
if(value == "PAIN")
displayPain();
if(value == "FATIGUE")
displayFatigue();
if(value == "MOBILITY")
displayMobility();
if(value == "BRAINFOG")
displayBrainFog();
}
function displayPain(){
calendar.update("samplejson1.json", false, calendar.RESET_ALL_ON_UPDATE);
}
function displayFatigue(){
calendar.update("fatigue.json", false, calendar.RESET_ALL_ON_UPDATE);
}
function displayMobility(){
calendar.update("mobility.json", false, calendar.RESET_ALL_ON_UPDATE);
}
function displayBrainFog(){
calendar.update("brainfog.json", false, calendar.RESET_ALL_ON_UPDATE);
}
</script>
<div id="legend"><p>Severity Level Legend</p> <br/>
<div id="empty"><p>No data</p></div>
<div id="zero"><p>0</p></div>
<div id="one"><p>1</p></div>
<div id="two"><p>2</p></div>
<div id="three"><p>3</p></div>
<div id="four"><p>4</p></div>
<div id="five"><p>5</p></div>
</div>
</body>
</html>