Skip to content

Commit 0e69a02

Browse files
committed
fix(area-chart): show seconds in XAxis
1 parent cddd546 commit 0e69a02

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

dashboard/src/components/charts/AreaCostumeChart.tsx

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -117,7 +117,8 @@ const CustomTooltip = ({ active, payload, period, viewMode }: any) => {
117117
const now = new Date()
118118
const timeParts = data.time.split(':')
119119
if (timeParts.length >= 2) {
120-
now.setHours(parseInt(timeParts[0]), parseInt(timeParts[1]), 0)
120+
const seconds = timeParts.length >= 3 ? parseInt(timeParts[2]) : 0
121+
now.setHours(parseInt(timeParts[0]), parseInt(timeParts[1]), seconds)
121122
}
122123

123124
if (i18n.language === 'fa') {
@@ -128,6 +129,7 @@ const CustomTooltip = ({ active, payload, period, viewMode }: any) => {
128129
day: '2-digit',
129130
hour: '2-digit',
130131
minute: '2-digit',
132+
second: '2-digit',
131133
hour12: false,
132134
})
133135
.replace(',', '')
@@ -139,6 +141,7 @@ const CustomTooltip = ({ active, payload, period, viewMode }: any) => {
139141
day: '2-digit',
140142
hour: '2-digit',
141143
minute: '2-digit',
144+
second: '2-digit',
142145
hour12: false,
143146
})
144147
.replace(',', '')
@@ -265,7 +268,7 @@ export function AreaCostumeChart({ nodeId, currentStats, realtimeStats }: AreaCo
265268

266269
try {
267270
const now = new Date()
268-
const timeStr = `${now.getHours().toString().padStart(2, '0')}:${now.getMinutes().toString().padStart(2, '0')}`
271+
const timeStr = `${now.getHours().toString().padStart(2, '0')}:${now.getMinutes().toString().padStart(2, '0')}:${now.getSeconds().toString().padStart(2, '0')}`
269272

270273
let cpuUsage = 0
271274
let ramUsage = 0

0 commit comments

Comments
 (0)