Last active
August 31, 2020 18:46
-
-
Save aadibajpai/b0c11721056325d4892cf926b950cdb1 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
<div id='covid-vandy'><!-- chart will be drawn inside this DIV --></div> | |
<script src='https://cdn.plot.ly/plotly-latest.min.js'></script> | |
<script> | |
Plotly.d3.csv("https://gist.githubusercontent.com/aadibajpai/b0c11721056325d4892cf926b950cdb1" + | |
"/raw/Weekly%2520New%2520Cases%2520Students.csv", function(err, rows) { | |
function unpack(rows, key) { | |
return rows.map(function (row) { | |
return row[key]; | |
}); | |
} | |
console.log(rows) | |
let trace1 = { | |
x: unpack(rows, 'Category'), | |
y: unpack(rows, "Undergraduate students living on campus"), | |
type: 'scatter', | |
mode: 'lines', | |
name: 'Undergraduate Students living on Campus', | |
// hovertext: 'On Campus', | |
// hoverinfo: 'y+text,' | |
hoverlabel: {namelength :-1} | |
}; | |
let trace2 = { | |
x: unpack(rows, 'Category'), | |
y: unpack(rows, "Undergraduate students living off campus"), | |
type: 'scatter', | |
mode: 'lines', | |
name: 'Undergraduate Students living off Campus', | |
// hovertext: 'Off Campus', | |
// hoverinfo: 'y+text', | |
hoverlabel: {namelength :-1} | |
}; | |
let trace3 = { | |
x: unpack(rows, 'Category'), | |
y: unpack(rows, "Graduate and professional students living off campus"), | |
type: 'scatter', | |
mode: 'lines', | |
name: 'Graduate and professional students living off campus', | |
// hovertext: 'Off Campus', | |
// hoverinfo: 'y+text', | |
hoverlabel: {namelength :-1} | |
}; | |
let layout = { | |
title:'Real-Time COVID-19 Positive Cases Tracker at Vanderbilt' | |
}; | |
let config = {responsive: true} | |
let data = [trace1, trace2, trace3]; | |
Plotly.newPlot('covid-vandy', data, layout, config); | |
}); | |
</script> |
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
Category | Graduate and professional students living off campus | Undergraduate students living off campus | Undergraduate students living on campus | |
---|---|---|---|---|
17 Aug | 0 | 0 | 0 | |
18 Aug | 0 | 1 | 0 | |
19 Aug | 0 | 1 | 0 | |
20 Aug | 0 | 6 | 2 | |
21 Aug | 0 | 0 | 0 | |
22 Aug | 0 | 2 | 1 | |
23 Aug | 0 | 2 | 1 | |
24 Aug | 1 | 15 | 6 | |
25 Aug | 0 | 0 | 0 | |
26 Aug | 0 | 2 | 4 | |
27 Aug | 0 | 3 | 6 | |
28 Aug | 1 | 5 | 3 | |
29 Aug | 3 | 2 | 1 | |
30 Aug | 0 | 0 | 0 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment