Skip to content

Commit

Permalink
update
Browse files Browse the repository at this point in the history
  • Loading branch information
C-D-Lewis committed Oct 21, 2024
1 parent f85b3c4 commit 036bdca
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion dashboard2/src/components/DeviceMetrics.ts
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,6 @@ const MetricGraph = ({ name } : { name: string }) => {
const draw = (state: AppState) => {
const { width, height } = canvas;
const { buckets, minValue, maxValue } = state[dataKey] as MetricData;

const range = maxValue - minValue;

const ctx = canvas.getContext('2d')!;
Expand All @@ -87,6 +86,13 @@ const MetricGraph = ({ name } : { name: string }) => {
return;
}

// Hour lines
const hourInterval = Math.round(width / 24);
for (let x = 0; x < 24; x += 3) {
ctx.fillStyle = (x % 6 === 0) ? Theme.palette.grey5 : Theme.palette.grey2;
ctx.fillRect(x * hourInterval, 0, 1, height);
}

// Latest data
const points = buckets.length > width ? buckets.slice(buckets.length - width) : buckets;
let minPoint: PlotPoint = { x: 0, y: 0, value: 0 };
Expand Down

0 comments on commit 036bdca

Please sign in to comment.