add jam ke to table pengujian

This commit is contained in:
Muhammad Izza Alfiansyah 2024-06-30 14:41:22 +07:00
parent 3ee2eca784
commit a9e292cf1e
2 changed files with 17 additions and 2 deletions

View File

@ -210,6 +210,8 @@ public:
};
void setup(){
status = "Menunggu";
pinMode(MQPIN, INPUT);
pinMode(LAMPPIN, OUTPUT);
pinMode(FANPIN, OUTPUT);
@ -300,6 +302,7 @@ void loop(){
digitalWrite(LAMPPIN, HIGH);
digitalWrite(FANPIN, HIGH);
digitalWrite(BUZZERPIN, LOW);
status = "Menunggu";
Serial.println("Mesin Siap!");

View File

@ -8,6 +8,7 @@ import { Chart, registerables } from "chart.js";
export default function () {
let canvas: any;
const [items, setItems] = createSignal<KondisiTapai[]>([]);
const [labels, setLabels] = createSignal<any>([]);
const getData = async () => {
const { data } = await supabase
@ -55,6 +56,8 @@ export default function () {
j += 1;
}
setLabels(labels);
new Chart(canvas, {
type: "line",
data: {
@ -122,14 +125,23 @@ export default function () {
classList={{ hidden: items().length < 1 }}
>
<canvas ref={canvas} style={{ "max-height": "300px" }}></canvas>
<div class="text-sm text-center">Jam Ke-</div>
</div>
<div class="bg-white rounded shadow p-5">
<Table
class="my-5"
headers={["Tanggal", "Jam", "Kadar Gas", "Suhu", "Kelembaban"]}
items={items().map((item) => [
headers={[
"Tanggal",
"Waktu",
"Jam Ke-",
"Kadar Gas",
"Suhu",
"Kelembaban",
]}
items={items().map((item, i) => [
getDates(item.created_time),
getTimes(item.created_time).slice(0, 5),
labels()[i],
item.kadar_gas.toString().slice(0, 4) + " %",
item.suhu.toString().slice(0, 4) + " C",
item.kelembaban.toString().slice(0, 4) + " %",