summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/components/sidebars/elements/LoadBarComponent.js23
-rw-r--r--src/components/sidebars/elements/LoadChartComponent.js53
-rw-r--r--src/util/date-time.js10
3 files changed, 55 insertions, 31 deletions
diff --git a/src/components/sidebars/elements/LoadBarComponent.js b/src/components/sidebars/elements/LoadBarComponent.js
index 5a39b188..0616d699 100644
--- a/src/components/sidebars/elements/LoadBarComponent.js
+++ b/src/components/sidebars/elements/LoadBarComponent.js
@@ -2,16 +2,19 @@ import classNames from "classnames";
import React from "react";
const LoadBarComponent = ({percent, disabled}) => (
- <div className={classNames("progress", {disabled})}>
- <div
- className="progress-bar progress-bar-striped"
- role="progressbar"
- aria-valuenow={percent}
- aria-valuemin="0"
- aria-valuemax="100"
- style={{width: percent + "%"}}
- >
- {percent}%
+ <div className="mt-1">
+ <strong>Current load</strong>
+ <div className={classNames("progress", {disabled})}>
+ <div
+ className="progress-bar progress-bar-striped"
+ role="progressbar"
+ aria-valuenow={percent}
+ aria-valuemin="0"
+ aria-valuemax="100"
+ style={{width: percent + "%"}}
+ >
+ {percent}%
+ </div>
</div>
</div>
);
diff --git a/src/components/sidebars/elements/LoadChartComponent.js b/src/components/sidebars/elements/LoadChartComponent.js
index 8b2438c2..a4e14a24 100644
--- a/src/components/sidebars/elements/LoadChartComponent.js
+++ b/src/components/sidebars/elements/LoadChartComponent.js
@@ -1,25 +1,40 @@
import React from "react";
-import {VictoryChart, VictoryLine, VictoryScatter} from "victory";
+import {VictoryAxis, VictoryChart, VictoryLine, VictoryScatter} from "victory";
+import {convertSecondsToFormattedTime} from "../../../util/date-time";
const LoadChartComponent = ({data, currentTick}) => (
- <VictoryChart height={300}>
- <VictoryLine
- data={data}
- />
- <VictoryScatter
- data={data}
- size={5}
- />
- <VictoryLine
- data={[
- {x: currentTick + 1, y: 0},
- {x: currentTick + 1, y: 1},
- ]}
- style={{
- data: {stroke: "#00A6D6", strokeWidth: 3}
- }}
- />
- </VictoryChart>
+ <div className="mt-1">
+ <strong>Load over time</strong>
+ <VictoryChart
+ height={250}
+ padding={{top: 10, bottom: 50, left: 50, right: 50}}
+ >
+ <VictoryAxis
+ tickFormat={tick => convertSecondsToFormattedTime(tick)}
+ fixLabelOverlap={true}
+ label="Simulated Time"
+ />
+ <VictoryAxis
+ dependentAxis
+ label="Load"
+ />
+ <VictoryLine
+ data={data}
+ />
+ <VictoryScatter
+ data={data}
+ />
+ <VictoryLine
+ data={[
+ {x: currentTick + 1, y: 0},
+ {x: currentTick + 1, y: 1},
+ ]}
+ style={{
+ data: {stroke: "#00A6D6", strokeWidth: 3}
+ }}
+ />
+ </VictoryChart>
+ </div>
);
export default LoadChartComponent;
diff --git a/src/util/date-time.js b/src/util/date-time.js
index 3ec6b671..26039368 100644
--- a/src/util/date-time.js
+++ b/src/util/date-time.js
@@ -106,7 +106,7 @@ export function addPaddingToTwo(integer) {
*/
export function convertSecondsToFormattedTime(seconds) {
if (seconds <= 0) {
- return "00:00:00";
+ return "0s";
}
let hour = Math.floor(seconds / 3600);
@@ -117,5 +117,11 @@ export function convertSecondsToFormattedTime(seconds) {
minute = isNaN(minute) ? 0 : minute;
second = isNaN(second) ? 0 : second;
- return addPaddingToTwo(hour) + ":" + addPaddingToTwo(minute) + ":" + addPaddingToTwo(second);
+ if (hour === 0 && minute === 0) {
+ return second + "s";
+ } else if (hour === 0) {
+ return minute + "m" + addPaddingToTwo(second) + "s";
+ } else {
+ return hour + "h" + addPaddingToTwo(minute) + "m" + addPaddingToTwo(second) + "s";
+ }
}