refactor: enhance chart layout and styles in ComparisonResult component; add Pie chart for cycle time data
This commit is contained in:
parent
c9cedaaaa3
commit
ab1230f166
|
@ -1,7 +1,7 @@
|
||||||
import React, { useMemo } from "react";
|
import React, { useMemo } from "react";
|
||||||
import PerformanceResult from "./result-card/PerformanceResult";
|
import PerformanceResult from "./result-card/PerformanceResult";
|
||||||
import EnergyUsage from "./result-card/EnergyUsage";
|
import EnergyUsage from "./result-card/EnergyUsage";
|
||||||
import { Bar, Line } from "react-chartjs-2";
|
import { Bar, Line, Pie } from "react-chartjs-2";
|
||||||
|
|
||||||
const ComparisonResult = () => {
|
const ComparisonResult = () => {
|
||||||
const options = useMemo(
|
const options = useMemo(
|
||||||
|
@ -33,21 +33,22 @@ const ComparisonResult = () => {
|
||||||
backgroundColor: [purpleDark, purpleLight],
|
backgroundColor: [purpleDark, purpleLight],
|
||||||
borderColor: [purpleDark, purpleLight],
|
borderColor: [purpleDark, purpleLight],
|
||||||
borderWidth: 1,
|
borderWidth: 1,
|
||||||
|
borderRadius: 10, // ✅ Rounded all corners (TypeScript-safe)
|
||||||
|
// borderSkipped: "bottom", // ✅ This is allowed by the Chart.js types
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
};
|
};
|
||||||
|
|
||||||
const cycleTimeData = {
|
|
||||||
|
const cycleTimePieData = {
|
||||||
labels: ["Layout 1", "Layout 2"],
|
labels: ["Layout 1", "Layout 2"],
|
||||||
datasets: [
|
datasets: [
|
||||||
{
|
{
|
||||||
label: "Cycle Time (sec)",
|
label: "Cycle Time (sec)",
|
||||||
data: [110, 110],
|
data: [120, 110],
|
||||||
backgroundColor: [purpleLight],
|
backgroundColor: [purpleDark, purpleLight],
|
||||||
borderColor: purpleDark,
|
borderColor: "#fff",
|
||||||
borderWidth: 2,
|
borderWidth: 2,
|
||||||
tension: 0.4,
|
|
||||||
fill: false,
|
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
};
|
};
|
||||||
|
@ -61,6 +62,8 @@ const ComparisonResult = () => {
|
||||||
backgroundColor: [purpleDark, purpleLight],
|
backgroundColor: [purpleDark, purpleLight],
|
||||||
borderColor: [purpleDark, purpleLight],
|
borderColor: [purpleDark, purpleLight],
|
||||||
borderWidth: 1,
|
borderWidth: 1,
|
||||||
|
borderRadius: 10,
|
||||||
|
borderSkipped: false,
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
};
|
};
|
||||||
|
@ -74,6 +77,8 @@ const ComparisonResult = () => {
|
||||||
backgroundColor: [purpleDark, purpleLight],
|
backgroundColor: [purpleDark, purpleLight],
|
||||||
borderColor: [purpleDark, purpleLight],
|
borderColor: [purpleDark, purpleLight],
|
||||||
borderWidth: 1,
|
borderWidth: 1,
|
||||||
|
borderRadius: 10,
|
||||||
|
borderSkipped: false,
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
};
|
};
|
||||||
|
@ -83,7 +88,6 @@ const ComparisonResult = () => {
|
||||||
<div className="header">Performance Comparison</div>
|
<div className="header">Performance Comparison</div>
|
||||||
<div className="compare-result-wrapper">
|
<div className="compare-result-wrapper">
|
||||||
<EnergyUsage />
|
<EnergyUsage />
|
||||||
|
|
||||||
<div className="throughPutCard-container comparisionCard">
|
<div className="throughPutCard-container comparisionCard">
|
||||||
<h4>Throughput (units/hr)</h4>
|
<h4>Throughput (units/hr)</h4>
|
||||||
<div className="layers-wrapper">
|
<div className="layers-wrapper">
|
||||||
|
@ -95,9 +99,9 @@ const ComparisonResult = () => {
|
||||||
<div className="key">Layout 2</div>
|
<div className="key">Layout 2</div>
|
||||||
<div className="value">550/ hr</div>
|
<div className="value">550/ hr</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
<div className="chart">
|
||||||
<div className="chart">
|
<Bar data={throughputData} options={options} />
|
||||||
<Bar data={throughputData} options={options} />
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
@ -122,7 +126,7 @@ const ComparisonResult = () => {
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div className="chart">
|
<div className="chart">
|
||||||
<Line data={cycleTimeData} options={options} />
|
<Pie data={cycleTimePieData} options={options} />
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|
|
@ -463,6 +463,7 @@
|
||||||
width: 100%;
|
width: 100%;
|
||||||
display: flex;
|
display: flex;
|
||||||
justify-content: space-between;
|
justify-content: space-between;
|
||||||
|
position: relative;
|
||||||
|
|
||||||
.layer-wrapper {
|
.layer-wrapper {
|
||||||
display: flex;
|
display: flex;
|
||||||
|
@ -472,6 +473,12 @@
|
||||||
justify-content: end;
|
justify-content: end;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.chart {
|
||||||
|
width: 60%;
|
||||||
|
height: 70%;
|
||||||
|
position: absolute;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
.chart {
|
.chart {
|
||||||
|
@ -484,6 +491,8 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
.cycle-time-container {
|
.cycle-time-container {
|
||||||
|
position: relative;
|
||||||
|
|
||||||
.cycle-main {
|
.cycle-main {
|
||||||
display: flex;
|
display: flex;
|
||||||
justify-content: space-between;
|
justify-content: space-between;
|
||||||
|
@ -519,6 +528,14 @@
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.chart {
|
||||||
|
position: absolute;
|
||||||
|
bottom: 0;
|
||||||
|
left: 10px;
|
||||||
|
width: 60%;
|
||||||
|
height: 80%;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
.overallDowntime-container {
|
.overallDowntime-container {
|
||||||
|
|
Loading…
Reference in New Issue