From 6cafb29a8fb7d8ada8af6a0adba761b88a41a830 Mon Sep 17 00:00:00 2001 From: Gabe Kangas Date: Wed, 11 Nov 2020 19:05:38 -0800 Subject: [PATCH] Customize legend titles. Hide empty graph lines. Update colors. --- web/pages/components/chart.tsx | 26 +++++++++++++++++--------- web/pages/hardware-info.tsx | 24 ++++++++++++------------ web/pages/viewer-info.tsx | 2 +- 3 files changed, 30 insertions(+), 22 deletions(-) diff --git a/web/pages/components/chart.tsx b/web/pages/components/chart.tsx index 080e722a4..14c8f89f7 100644 --- a/web/pages/components/chart.tsx +++ b/web/pages/components/chart.tsx @@ -22,6 +22,7 @@ interface TimedValue { interface ChartProps { data?: TimedValue[], + title?: string, color: string, unit: string, dataCollections?: any[], @@ -43,7 +44,7 @@ function CustomizedTooltip(props: ToolTipProps) { } CustomizedTooltip.defaultProps = defaultProps; -export default function Chart({ data, color, unit, dataCollections }: ChartProps) { +export default function Chart({ data, title, color, unit, dataCollections }: ChartProps) { if (!data && !dataCollections) { return null; } @@ -67,6 +68,18 @@ export default function Chart({ data, color, unit, dataCollections }: ChartProps }); } + const line = data ? ( + + ) : null; + return (
@@ -87,23 +100,18 @@ export default function Chart({ data, color, unit, dataCollections }: ChartProps /> } /> - + {line} {dataCollections?.map((s) => ( ))} diff --git a/web/pages/hardware-info.tsx b/web/pages/hardware-info.tsx index 58995c20c..c82e3cb5a 100644 --- a/web/pages/hardware-info.tsx +++ b/web/pages/hardware-info.tsx @@ -55,17 +55,17 @@ export default function HardwareInfo() { const series = [ { name: "CPU", - color: "#FF7700", + color: "#B63FFF", data: hardwareStatus.cpu, }, { name: "Memory", - color: "#004777", + color: "#2087E2", data: hardwareStatus.memory, }, { name: "Disk", - color: "#A9E190", + color: "#FF7700", data: hardwareStatus.disk, }, ]; @@ -76,24 +76,24 @@ const series = [

Hardware Info

} - color="#FF7700" + prefix={} + color={series[0].color} progress /> } - color="#004777" + prefix={} + color={series[1].color} progress /> } - color="#A9E190" + prefix={} + color={series[2].color} progress /> diff --git a/web/pages/viewer-info.tsx b/web/pages/viewer-info.tsx index 5595eacac..ad8fbb8a0 100644 --- a/web/pages/viewer-info.tsx +++ b/web/pages/viewer-info.tsx @@ -125,7 +125,7 @@ export default function ViewersOverTime() { />
- +
;