From 9ce6a0fb884016ec17b2426718226dd4f38c96d4 Mon Sep 17 00:00:00 2001 From: andersonid Date: Fri, 3 Oct 2025 09:29:34 -0300 Subject: [PATCH] Fix: format X-axis timestamps to readable time format in Victory.js charts --- app/static/index.html | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/app/static/index.html b/app/static/index.html index bbe9095..394e1f0 100644 --- a/app/static/index.html +++ b/app/static/index.html @@ -2913,6 +2913,7 @@ width: containerWidth, height: containerHeight, theme: Victory.VictoryTheme.material, + scale: { x: 'time' }, style: { parent: { background: '#1E1E1E', @@ -2933,10 +2934,18 @@ }), React.createElement(Victory.VictoryAxis, { key: 'x-axis', + scale: 'time', style: { axis: { stroke: '#404040' }, tickLabels: { fill: '#FFFFFF', fontSize: 12 }, grid: { stroke: '#404040' } + }, + tickFormat: (t) => { + const date = new Date(t); + return date.toLocaleTimeString('pt-BR', { + hour: '2-digit', + minute: '2-digit' + }); } }), React.createElement(Victory.VictoryLine, { @@ -2987,6 +2996,7 @@ width: containerWidth, height: containerHeight, theme: Victory.VictoryTheme.material, + scale: { x: 'time' }, style: { parent: { background: '#1E1E1E', @@ -3007,10 +3017,18 @@ }), React.createElement(Victory.VictoryAxis, { key: 'x-axis', + scale: 'time', style: { axis: { stroke: '#404040' }, tickLabels: { fill: '#FFFFFF', fontSize: 12 }, grid: { stroke: '#404040' } + }, + tickFormat: (t) => { + const date = new Date(t); + return date.toLocaleTimeString('pt-BR', { + hour: '2-digit', + minute: '2-digit' + }); } }), React.createElement(Victory.VictoryLine, {