Getting Started
Create the HTML, CSS, and Javascript files below and you are off to the races. Click on the file name to get the code content for each.
Ensure that your actual JavaScript filename matches the script element in the HTML <script src="code.js"></script>
index.html
code.js
style.css
1
<!DOCTYPE html>
2
<html>
3
4
<head>
5
<meta charset="utf-8">
6
<meta name="viewport" content="width=device-width">
7
<title>Dashboard Template</title>
8
<link href="style.css" rel="stylesheet" type="text/css" />
9
</head>
10
11
<body>
12
<h1>Data Dashboard</h1>
13
<div id='page'>
14
<div class="card">
15
<div id="chart1"></div>
16
</div>
17
<div class="card">
18
<div id="chart2"></div>
19
</div>
20
</div>
21
22
<!--Javascript-->
23
<script type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/PapaParse/5.1.0/papaparse.min.js"></script>
24
<script src='https://cdnjs.cloudflare.com/ajax/libs/jquery/3.3.1/jquery.min.js'></script>
25
<script type="text/javascript" src="https://www.gstatic.com/charts/loader.js"></script>
26
<script src="https://cdn.jsdelivr.net/alasql/0.2/alasql.min.js"></script>
27
<script src="https://cdn.jsdelivr.net/gh/idewcomputing/[email protected]/src/viz.js"></script>
28
<script src="code.js"></script>
29
</body>
30
31
</html>
Copied!
1
function setup() {
2
var degreesLink = 'https://docs.google.com/spreadsheets/d/e/2PACX-1vQUwF7K2lCH8CxQPJW-X7NqENwuwUM4eAeNUKw3j6yppO0tipC6yUB2hQPtRBZf19mmVbM5TdkkengZ/pub?gid=1030028695&single=true&output=csv';
3
viz.loadTable(degreesLink,"Degrees").then(composeDegreeCharts);
4
window.onresize = composeDegreeCharts;
5
}
6
7
function composeDegreeCharts() {
8
viz.chart({
9
sql:"SELECT Major, StartingMedianSalary FROM Degrees",
10
chartType:"BarChart",
11
containerId:"chart1"
12
});
13
14
viz.chart({
15
sql:"SELECT * FROM Degrees",
16
chartType:"Table",
17
containerId:"chart2"
18
});
19
}
20
21
window.onload = setup;
22
Copied!
1
body {
2
padding: 15px;
3
margin: 0;
4
background: #eee;
5
}
6
7
#page {
8
display: grid;
9
/* grid-template-columns: repeat(auto-fill, minmax(400px, 1fr)); */
10
grid-gap: 15px;
11
}
12
13
h1 {
14
font-family: 'Arial';
15
text-align: center;
16
}
17
18
.card {
19
box-shadow: 0 4px 8px 0 rgba(0, 0, 0, 0.4), 0 6px 20px 0 rgba(0, 0, 0, 0.4);
20
overflow: hidden;
21
background: white;
22
}
23
24
.description {
25
padding: 15px 7px;
26
}
Copied!
Note: August 30, 2021 the Papaparse Javascript library was added to the template in the HTML above with the following line ...
1
<script type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/PapaParse/5.1.0/papaparse.min.js"></script>
Copied!

Copyright and License

Copyright © 2018-2019 Jim Lyst and Michael Frontz, Indiana University School of Informatics and Computing at IUPUI
This material is part of the Computing by Design high school computer science curriculum developed for the Informatics Diversity-Enhanced Workforce (iDEW) program, an award-winning community partnership in central Indiana that is broadening student participation in computing and helping students develop the skills essential for success in the 21st century workplace. The iDEW program is managed by the Indiana University School of Informatics and Computing at IUPUI.
This work is licensed under a Creative Commons Attribution-NonCommercial-ShareAlike 4.0 International License. You are free to use, share, or adapt this material for noncommercial purposes as long as you provide proper attribution and distribute any copies or adaptations under this same license.
Last modified 1mo ago
Copy link