diff --git a/studio/components/interfaces/Settings/Logs/LogEventChart.tsx b/studio/components/interfaces/Settings/Logs/LogEventChart.tsx index e82aebf04ee..0163b15aaa0 100644 --- a/studio/components/interfaces/Settings/Logs/LogEventChart.tsx +++ b/studio/components/interfaces/Settings/Logs/LogEventChart.tsx @@ -40,6 +40,9 @@ const LogEventChart: React.FC = ({ data, onBarClick }) => { return ( = ({ data, onBarClick }) => { // 60s before onBarClick((Number(timestamp) + 60) * 1000 * 1000) }} - customDateFormat="YYYY-MM-DDTHH:mm:ss" + customDateFormat="D MMM, HH:mm" /> ) } diff --git a/studio/components/to-be-cleaned/Charts/ChartRenderer.tsx b/studio/components/to-be-cleaned/Charts/ChartRenderer.tsx index 447d3203914..a73b115a30c 100644 --- a/studio/components/to-be-cleaned/Charts/ChartRenderer.tsx +++ b/studio/components/to-be-cleaned/Charts/ChartRenderer.tsx @@ -44,6 +44,7 @@ const Header = ({ data, customDateFormat, label, + minimalHeader = false, }: any) => { let FOCUS_FORMAT = customDateFormat ? customDateFormat @@ -85,22 +86,44 @@ const Header = ({ } } + const chartTitle = ( + + {label ?? attribute} + + ) + const highlighted = ( + + {title} + {format} + + ) + const date = ( + + {focus ? ( + data && data[focus] && dayjs(data[focus].period_start).format(FOCUS_FORMAT) + ) : ( + x + )} + + ) + + if (minimalHeader) { + return ( +
+ {chartTitle} +
+ {highlighted} + {date} +
+
+ ) + } + return ( <> - - {label ?? attribute} - - - {title} - {format} - - - {focus ? ( - data && data[focus] && dayjs(data[focus].period_start).format(FOCUS_FORMAT) - ) : ( - x - )} - + {chartTitle} + {highlighted} + {date} ) } @@ -144,6 +167,9 @@ export function BarChart({ customDateFormat, label, onBarClick, + minimalHeader, + minmalChart, + className = '', }: any) { const hasData = data ? dataCheck(data, attribute) : true @@ -167,89 +193,92 @@ export function BarChart({ return ( -
-
- {hasData ? ( - <> - - { - // receives tooltip data https://github.com/recharts/recharts/blob/2a3405ff64a0c050d2cf94c36f0beef738d9e9c2/src/chart/generateCategoricalChart.tsx - if (onBarClick) onBarClick(tooltipData) - }} - > - - } /> - {/* */} - {/* */} - {yAxisLimit && } - +
+
+ {hasData ? ( + <> + + { + // receives tooltip data https://github.com/recharts/recharts/blob/2a3405ff64a0c050d2cf94c36f0beef738d9e9c2/src/chart/generateCategoricalChart.tsx + if (onBarClick) onBarClick(tooltipData) + }} > - {data?.map((entry: any, index: any) => ( - - ))} - - - - {data && ( -
- - {dayjs(data[0].period_start).format( - customDateFormat ? customDateFormat : DATE_FORMAT__WITH_TIME - )} - - - {dayjs(data[data?.length - 1]?.period_start).format( - customDateFormat ? customDateFormat : DATE_FORMAT__WITH_TIME - )} - -
- )} - - ) : ( - - )} + + } /> + {/* */} + {/* */} + {yAxisLimit && } + + {data?.map((entry: any, index: any) => ( + + ))} + + + + {data && ( +
+ + {dayjs(data[0].period_start).format( + customDateFormat ? customDateFormat : DATE_FORMAT__WITH_TIME + )} + + + {dayjs(data[data?.length - 1]?.period_start).format( + customDateFormat ? customDateFormat : DATE_FORMAT__WITH_TIME + )} + +
+ )} + + ) : ( + + )} +
)