update show graph
This commit is contained in:
@@ -5,6 +5,7 @@ body {
|
|||||||
margin: 0;
|
margin: 0;
|
||||||
padding: 0;
|
padding: 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
#timer {
|
#timer {
|
||||||
font-size: 48px;
|
font-size: 48px;
|
||||||
text-align: center;
|
text-align: center;
|
||||||
@@ -13,26 +14,31 @@ body {
|
|||||||
border: 2px solid #666;
|
border: 2px solid #666;
|
||||||
margin: 0;
|
margin: 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
#create-plan {
|
#create-plan {
|
||||||
padding: 20px;
|
padding: 20px;
|
||||||
text-align: center;
|
text-align: center;
|
||||||
}
|
}
|
||||||
|
|
||||||
#create-plan input {
|
#create-plan input {
|
||||||
width: 80%;
|
width: 80%;
|
||||||
padding: 10px;
|
padding: 10px;
|
||||||
font-size: 18px;
|
font-size: 18px;
|
||||||
}
|
}
|
||||||
|
|
||||||
#create-plan button {
|
#create-plan button {
|
||||||
margin-top: 10px;
|
margin-top: 10px;
|
||||||
padding: 10px 20px;
|
padding: 10px 20px;
|
||||||
font-size: 18px;
|
font-size: 18px;
|
||||||
}
|
}
|
||||||
|
|
||||||
#controls {
|
#controls {
|
||||||
display: flex;
|
display: flex;
|
||||||
flex-direction: column;
|
flex-direction: column;
|
||||||
align-items: center;
|
align-items: center;
|
||||||
padding: 20px;
|
padding: 20px;
|
||||||
}
|
}
|
||||||
|
|
||||||
.button-group {
|
.button-group {
|
||||||
display: flex;
|
display: flex;
|
||||||
flex-wrap: wrap;
|
flex-wrap: wrap;
|
||||||
@@ -40,6 +46,7 @@ body {
|
|||||||
gap: 10px;
|
gap: 10px;
|
||||||
margin: 10px;
|
margin: 10px;
|
||||||
}
|
}
|
||||||
|
|
||||||
.button-group button:not(.nav-btn) {
|
.button-group button:not(.nav-btn) {
|
||||||
font-size: 20px;
|
font-size: 20px;
|
||||||
border: 2px solid #666;
|
border: 2px solid #666;
|
||||||
@@ -48,6 +55,7 @@ body {
|
|||||||
border-radius: 10px;
|
border-radius: 10px;
|
||||||
cursor: pointer;
|
cursor: pointer;
|
||||||
}
|
}
|
||||||
|
|
||||||
.button-group .nav-btn {
|
.button-group .nav-btn {
|
||||||
padding: 15px 25px;
|
padding: 15px 25px;
|
||||||
font-size: 20px;
|
font-size: 20px;
|
||||||
@@ -57,9 +65,11 @@ body {
|
|||||||
border-radius: 10px;
|
border-radius: 10px;
|
||||||
cursor: pointer;
|
cursor: pointer;
|
||||||
}
|
}
|
||||||
|
|
||||||
.button-group button:active {
|
.button-group button:active {
|
||||||
background-color: #ddd;
|
background-color: #ddd;
|
||||||
}
|
}
|
||||||
|
|
||||||
#event-buttons {
|
#event-buttons {
|
||||||
display: flex;
|
display: flex;
|
||||||
flex-wrap: wrap;
|
flex-wrap: wrap;
|
||||||
@@ -67,6 +77,7 @@ body {
|
|||||||
gap: 10px;
|
gap: 10px;
|
||||||
margin: 20px;
|
margin: 20px;
|
||||||
}
|
}
|
||||||
|
|
||||||
#event-buttons button {
|
#event-buttons button {
|
||||||
padding: 15px 25px;
|
padding: 15px 25px;
|
||||||
font-size: 20px;
|
font-size: 20px;
|
||||||
@@ -76,30 +87,38 @@ body {
|
|||||||
border-radius: 10px;
|
border-radius: 10px;
|
||||||
cursor: pointer;
|
cursor: pointer;
|
||||||
}
|
}
|
||||||
|
|
||||||
#event-buttons button:active {
|
#event-buttons button:active {
|
||||||
background-color: #ddd;
|
background-color: #ddd;
|
||||||
}
|
}
|
||||||
|
|
||||||
#log-table {
|
#log-table {
|
||||||
width: 100%;
|
width: 100%;
|
||||||
border-collapse: collapse;
|
border-collapse: collapse;
|
||||||
}
|
}
|
||||||
|
|
||||||
#log-table table {
|
#log-table table {
|
||||||
table-layout: fixed;
|
table-layout: fixed;
|
||||||
width: 90%;
|
width: 90%;
|
||||||
margin: auto;
|
margin: auto;
|
||||||
}
|
}
|
||||||
#log-table th, #log-table td {
|
|
||||||
|
#log-table th,
|
||||||
|
#log-table td {
|
||||||
border: 1px solid #666;
|
border: 1px solid #666;
|
||||||
padding: 10px;
|
padding: 10px;
|
||||||
text-align: center;
|
text-align: center;
|
||||||
}
|
}
|
||||||
|
|
||||||
#log-table th {
|
#log-table th {
|
||||||
background-color: #f0e6ff;
|
background-color: #f0e6ff;
|
||||||
}
|
}
|
||||||
|
|
||||||
#export-csv {
|
#export-csv {
|
||||||
margin: 20px;
|
margin: 20px;
|
||||||
text-align: center;
|
text-align: center;
|
||||||
}
|
}
|
||||||
|
|
||||||
#export-csv button {
|
#export-csv button {
|
||||||
padding: 10px 20px;
|
padding: 10px 20px;
|
||||||
font-size: 18px;
|
font-size: 18px;
|
||||||
@@ -109,32 +128,42 @@ body {
|
|||||||
border-radius: 10px;
|
border-radius: 10px;
|
||||||
cursor: pointer;
|
cursor: pointer;
|
||||||
}
|
}
|
||||||
|
|
||||||
#export-csv button:active {
|
#export-csv button:active {
|
||||||
background-color: #ddd;
|
background-color: #ddd;
|
||||||
}
|
}
|
||||||
|
|
||||||
.hidden {
|
.hidden {
|
||||||
display: none;
|
display: none;
|
||||||
}
|
}
|
||||||
|
|
||||||
#temp-buttons {
|
#temp-buttons {
|
||||||
margin: 8px;
|
margin: 8px;
|
||||||
}
|
}
|
||||||
|
|
||||||
#temp-buttons button {
|
#temp-buttons button {
|
||||||
text-align: center;
|
text-align: center;
|
||||||
width: 3.5em;
|
width: 3.5em;
|
||||||
}
|
}
|
||||||
|
#graph-container {
|
||||||
.graph-container {
|
position: fixed; /* Centered and float over the screen */
|
||||||
position: relative;
|
top: 50%;
|
||||||
|
left: 50%;
|
||||||
|
transform: translate(-50%, -50%); /* Aligns perfectly center */
|
||||||
width: 100%;
|
width: 100%;
|
||||||
max-width: 800px;
|
max-width: 800px;
|
||||||
height: 400px;
|
height: 400px;
|
||||||
display: flex;
|
|
||||||
justify-content: center;
|
justify-content: center;
|
||||||
align-items: center;
|
align-items: center;
|
||||||
background-color: #fff;
|
background-color: #fff;
|
||||||
border: 1px solid #ccc;
|
border: 1px solid #ccc;
|
||||||
box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
|
box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
|
||||||
overflow: hidden;
|
overflow: hidden;
|
||||||
|
z-index: 1000; /* Ensures it's above other elements */
|
||||||
|
}
|
||||||
|
|
||||||
|
.graph-display-flex {
|
||||||
|
display: flex;
|
||||||
}
|
}
|
||||||
|
|
||||||
canvas {
|
canvas {
|
||||||
|
|||||||
@@ -40,7 +40,7 @@
|
|||||||
</tbody>
|
</tbody>
|
||||||
</table>
|
</table>
|
||||||
</div>
|
</div>
|
||||||
<div id="graph-container">
|
<div id="graph-container" class="hidden">
|
||||||
<button id="close-btn">X</button>
|
<button id="close-btn">X</button>
|
||||||
<canvas id="myChart"></canvas>
|
<canvas id="myChart"></canvas>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
15
src/roast.ts
15
src/roast.ts
@@ -1,3 +1,5 @@
|
|||||||
|
|
||||||
|
|
||||||
let timer = 0;
|
let timer = 0;
|
||||||
let isRunning = false;
|
let isRunning = false;
|
||||||
let log: Array<{ time: string, event: string, temp?: number }> = [];
|
let log: Array<{ time: string, event: string, temp?: number }> = [];
|
||||||
@@ -5,6 +7,7 @@ let targets: number[] = [];
|
|||||||
let currentTargetIndex = 0;
|
let currentTargetIndex = 0;
|
||||||
let interval: NodeJS.Timeout | null = null;
|
let interval: NodeJS.Timeout | null = null;
|
||||||
|
|
||||||
|
|
||||||
interface Window {
|
interface Window {
|
||||||
startTimer?: Function; // function to start the timer
|
startTimer?: Function; // function to start the timer
|
||||||
stopTimer?: Function; // function to stop the timer
|
stopTimer?: Function; // function to stop the timer
|
||||||
@@ -14,9 +17,10 @@ interface Window {
|
|||||||
navigateTemp?: Function; //function to navigate forward/back between events in the setPlan() temp plan
|
navigateTemp?: Function; //function to navigate forward/back between events in the setPlan() temp plan
|
||||||
logTemp?: Function; //function to log a temputure event
|
logTemp?: Function; //function to log a temputure event
|
||||||
exportCSV?: Function; //function to export the events to CSV
|
exportCSV?: Function; //function to export the events to CSV
|
||||||
showGraph?: Function; //function to show the graph on screen
|
showGraph?: Function; // function to render or display graphs using libraries like Chart.js for visual representation of logged events
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
function startTimer(): void {
|
function startTimer(): void {
|
||||||
if (isRunning) {
|
if (isRunning) {
|
||||||
alert("Timer is already running. Click again to reset.");
|
alert("Timer is already running. Click again to reset.");
|
||||||
@@ -156,6 +160,14 @@ function exportCSV(): void {
|
|||||||
document.body.removeChild(link);
|
document.body.removeChild(link);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function showGraph(): void {
|
||||||
|
const graphContainer = document.getElementById("graph-container");
|
||||||
|
if (graphContainer) {
|
||||||
|
graphContainer.classList.remove("hidden");
|
||||||
|
graphContainer.classList.add("graph-display-flex");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// Expose functions to the global scope (allowing html direct access)
|
// Expose functions to the global scope (allowing html direct access)
|
||||||
if (typeof window !== 'undefined') {
|
if (typeof window !== 'undefined') {
|
||||||
window.startTimer = startTimer;
|
window.startTimer = startTimer;
|
||||||
@@ -166,4 +178,5 @@ if (typeof window !== 'undefined') {
|
|||||||
window.navigateTemp = navigateTemp;
|
window.navigateTemp = navigateTemp;
|
||||||
window.logTemp = logTemp;
|
window.logTemp = logTemp;
|
||||||
window.exportCSV = exportCSV;
|
window.exportCSV = exportCSV;
|
||||||
|
window.showGraph = showGraph;
|
||||||
}
|
}
|
||||||
@@ -6,7 +6,6 @@ import {AnnotationOptions} from 'chartjs-plugin-annotation';
|
|||||||
Chart.register(...registerables);
|
Chart.register(...registerables);
|
||||||
Chart.register(annotationPlugin);
|
Chart.register(annotationPlugin);
|
||||||
|
|
||||||
function updateData()
|
|
||||||
const sampleData = `Time,Event,Temperature
|
const sampleData = `Time,Event,Temperature
|
||||||
0:00,Charge,
|
0:00,Charge,
|
||||||
0:00,Temp,139
|
0:00,Temp,139
|
||||||
|
|||||||
Reference in New Issue
Block a user