Skip to content

Commit

Permalink
chore: use Colors instead of hex + dummy data for 90 days
Browse files Browse the repository at this point in the history
  • Loading branch information
ahmadshaheer committed Sep 2, 2024
1 parent 3e88c73 commit 767448d
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 11 deletions.
24 changes: 14 additions & 10 deletions frontend/src/container/AlertHistory/Timeline/Graph/Graph.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -87,16 +87,20 @@ const transformVerticalTimelineGraph = (data: any[]): any => [
return [...Array(count).fill(1), 2];
}),
];
const datatest = [
{
timestamp: 1724941976.194,
value: 20,
},
{
timestamp: 1724855576.194,
value: 30,
},
];

const datatest: any[] = [];
const now = Math.floor(Date.now() / 1000); // current timestamp in seconds
const oneDay = 24 * 60 * 60; // one day in seconds

for (let i = 0; i < 90; i++) {
const timestamp = now - i * oneDay;
const startOfDay = timestamp - (timestamp % oneDay);
datatest.push({
timestamp: startOfDay,
value: Math.floor(Math.random() * 60) + 1,
});
}

function VerticalTimelineGraph({
isDarkMode,
width,
Expand Down
3 changes: 2 additions & 1 deletion frontend/src/lib/uPlotLib/plugins/heatmapPlugin.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
import { Color } from '@signozhq/design-tokens';
import uPlot from 'uplot';

const bucketIncr = 5;

function heatmapPlugin(): uPlot.Plugin {
function fillStyle(count: number): string {
const colors = ['#E5484D', '#25E192'];
const colors = [Color.BG_CHERRY_500, Color.BG_SLATE_400];
return colors[count - 1];
}

Expand Down

0 comments on commit 767448d

Please sign in to comment.