I am trying to implement this timeline that I have created on CodePen.io into my web page, but above all the other div elements. However, when I try to input the div above, all I get is a blank rectangle exactly where I would want the timeline to be. Is there a reason why it is coming back as blank and not with the javascript timeline that was made?
https://codepen.io/redking613/pen/QWQMOPZ
Picture of what website looks now & where I want the timeline to be
Picture of what my timeline looks like via CodePen.io
I appreciate any help that I can get! Thank you.
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Milestone 3</title>
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="stylesheet" href="w3.css">
<script src="https://cdnjs.cloudflare.com/ajax/libs/Chart.js/2.9.4/Chart.js"></script>
<img src="SANDYMC.png" alt="Sandy Shores MC" style="width: 450px;">
<style>
.column-left {
float: left;
width: 20%;
height: 800px;
text-align: center;
}
.column-right {
float: right;
width: 20%;
height: 800px;
text-align: center;
}
.column-center {
display: inline-block;
width: 60%;
height: 800px;
text-align: center;
}
table,
th,
td {
border: 1px solid;
margin-left: 100px;
}
body,
html {
font-family: arial, sans-serif;
font-size: 11pt;
}
#visualization {
box-sizing: border-box;
width: 100%;
height: 300px;
}
.vis-item.medications {
background-color: #b0e2ff;
}
.vis-item.appointments {
background-color: #eaeaea;
}
.vis-item.messages {
background-color: #fa8072;
}
.vis-item.procedures {
background-color: #b4eeb4;
}
.vis-item.testResults {
background-color: #ffffcc;
}
.vis-item.hospitalAdmissions {
background-color: #ffffcc;
}
</style>
</head>
<body>
<h2>Patient Portal</h2>
<div id="visualization"></div>
<script>
var groups = new vis.DataSet([
{ content: "Medications", id: "Medications", value: 1, className: "medicationClass" },
{ content: "Allergies", id: "Allergies", value: 2, classname: "allergiesClass" },
{ content: "Messages", id: "Messages", value: 3, className: "messagesClass" },
{ content: "Procedures", id: "Procedures", value: 4, classname: "proceduresClass" },
{ content: "Test Results", id: "testResults", value: 5, className: "testresultsClass" },
{ content: "Hospital Admissions", id: "hospitalAdmissions", value: 6, className: "hospitalClass" },
]);
function showAllGroups() {
groups.forEach(function (group) {
groups.update({ id: group.id, visible: true });
});
}
var items = new vis.DataSet([
{
start: new Date(2020, 05),
group: "Medications",
className: "medicationClass",
content: "<h4 class='eventtitle'>Tylenol</h4>",
},
{
start: new Date(2020, 05),
group: "Allergies",
classname: "allergiesClass",
content: "<h4 class='eventtitle'>Allergy</h4>Type: Peanuts",
},
{
start: new Date(2021, 01),
group: "Messages",
classname: "messagesClass",
content: "<h4 class='eventtitle'>Message</h4>(1) Unread Message",
},
{
start: new Date(2019, 09),
group: "Allergies",
classname: "allergiesClass",
content: "<h4 class='eventtitle'>Allergy</h4>Type: Latex",
},
{
start: new Date(2018, 07),
group: "Procedures",
className: "proceduresClass",
content: "<h4 class='eventtitle'>Procedures</h4>Type: Knee Replacement",
},
{
start: new Date(2015, 02),
group: "testResults",
className: "testresultsClass",
content: "<h4 class='eventtitle'>Test Result</h4>Type: Lab Test",
},
{
start: new Date(2016, 09),
group: "hospitalAdmissions",
className: "hospitalClass",
content: "<h4 class='eventtitle'>Hospital Admission</h4>Patient scheduled for surgery",
},
]);
// create visualization
var container = document.getElementById("visualization");
var options = {
groupOrder: function (a, b) {
return a.value - b.value;
},
groupOrderSwap: function (a, b, groups) {
var v = a.value;
a.value = b.value;
b.value = v;
},
groupTemplate: function (group) {
var container = document.createElement("div");
var label = document.createElement("span");
label.innerHTML = group.content + " ";
container.insertAdjacentElement("afterBegin", label);
var hide = document.createElement("button");
hide.innerHTML = "hide";
hide.style.fontSize = "small";
hide.addEventListener("click", function () {
groups.update({ id: group.id, visible: false });
});
container.insertAdjacentElement("beforeEnd", hide);
return container;
},
orientation: "both",
editable: true,
groupEditable: true,
start: new Date(2012, 6),
end: new Date(2022, 10),
};
var timeline = new vis.Timeline(container);
timeline.setOptions(options);
timeline.setGroups(groups);
timeline.setItems(items);
</script>
<div class="container">
<div class="column-left" style="background-color:#aaa;" height: 100%>
<h2>Health Record</h2>
<button class="w3-button w3-hover-black">Medications</button>
<br>
<br>
<br>
<br>
<button class="w3-button w3-hover-black">Appointments</button>
<br>
<br>
<br>
<br>
<button class="w3-button w3-hover-black">Messages</button>
<br>
<br>
<br>
<br>
<button class="w3-button w3-hover-black">Procedures</button>
<br>
<br>
<br>
<br>
<button class="w3-button w3-hover-black">Test Results</button>
<br>
<br>
<br>
<br>
<button class="w3-button w3-hover-black">Hospital Admissions</button>
</div>
<div class="column-center w3-border" style="background-color:rgb(117, 114, 114)
;">
<h2>Patient History</h2>
<div class="w3-panel w3-border w3-border-black">
<h3>Advil - Medications</h3>
<strong>01/28/2022</strong>
<p>Patient was prescribed advil to reduce migraines and reduce fever.</p>
</div>
<div class="w3-panel w3-border w3-border-black">
<h3>Lastest Visit Summary - Appointments</h3>
<strong>01/27/2022</strong>
<p>Patient described issues consisting of migraines, high fevers, etc.
<br>
Prescription for advil was given to the patient.
<br>
Sore throat, runny nose symptoms
</p>
</div>
<div class="w3-panel w3-border w3-border-black">
<h3>Metal Knee Replacement - Procedures</h3>
<strong>12/26/2021</strong>
<p>Patient got a new Metal Knee.
</p>
</div>
<div class="w3-panel w3-border w3-border-black">
<h3>Adderall - Medications</h3>
<strong>08/17/2021</strong>
<p>Patient prescribed for adderall medication due to ADHD diagnosis.
</p>
</div>
</div>
<div class="column-right" style="background-color:#aaa;">
<h2>Key Metrics</h2>
<p>Height</p>
<canvas id="linear" style="width:100%;max-width:600px"></canvas>
<script>
var xValues = [];
var yValues = [];
generateData("x * 2 + 7", 0, 10, 0.5);
new Chart("linear", {
type: "line",
data: {
labels: xValues,
datasets: [{
fill: false,
pointRadius: 1,
borderColor: "rgba(255,0,0,0.5)",
data: yValues
}]
},
options: {
legend: { display: false },
title: {
display: true,
text: "Patient Height Chart - (Lifespan)",
fontSize: 16
}
}
});
function generateData(value, i1, i2, step = 1) {
for (let x = i1; x <= i2; x += step) {
yValues.push(eval(value));
xValues.push(x);
}
}
</script>
<p>Weight Chart</p>
<canvas id="myChart" style="width:100%;max-width:600px"></canvas>
<script>
var xValues = [50, 60, 70, 80, 90, 100, 110, 120, 130, 140, 150];
var yValues = [7, 8, 8, 9, 9, 9, 10, 11, 14, 14, 15];
new Chart("myChart", {
type: "line",
data: {
labels: xValues,
datasets: [{
fill: false,
lineTension: 0,
backgroundColor: "rgba(0,0,255,1.0)",
borderColor: "rgba(0,0,255,0.1)",
data: yValues
}]
},
options: {
legend: { display: false },
scales: {
yAxes: [{ ticks: { min: 6, max: 16 } }],
}
}
});
</script>
<h3>Allergies</h3>
<p>Peanuts, Apple, Milk</p>
</html>