Skip to content

The Postgres development platform. Supabase gives you a dedicated Postgres database to build your web, mobile, and AI applications.

fillTimeseries: Skip filling if theres a minimum of datapoints (#31311)

Jordi Enricb447ef62d100
diff --git a/apps/studio/components/interfaces/Home/ProjectUsage.tsx b/apps/studio/components/interfaces/Home/ProjectUsage.tsx
index b872fc4657c..1c9b9c6cfa3 100644
--- a/apps/studio/components/interfaces/Home/ProjectUsage.tsx
+++ b/apps/studio/components/interfaces/Home/ProjectUsage.tsx
@@ -64,7 +64,8 @@ const ProjectUsage = () => {
],
0,
startDateLocal.toISOString(),
- endDateLocal.toISOString()
+ endDateLocal.toISOString(),
+ 5
)
const datetimeFormat = selectedInterval.format || 'MMM D, ha'
diff --git a/apps/studio/components/interfaces/Settings/Logs/Logs.utils.ts b/apps/studio/components/interfaces/Settings/Logs/Logs.utils.ts
index 7367bf296ee..527194f63af 100644
--- a/apps/studio/components/interfaces/Settings/Logs/Logs.utils.ts
+++ b/apps/studio/components/interfaces/Settings/Logs/Logs.utils.ts
@@ -458,8 +458,18 @@ export const fillTimeseries = (
valueKey: string | string[],
defaultValue: number,
min?: string,
- max?: string
+ max?: string,
+ minPointsToFill: number = 20
) => {
+ // If we have more points than minPointsToFill, just normalize timestamps and return
+ if (timeseriesData.length > minPointsToFill) {
+ return timeseriesData.map((datum) => {
+ const iso = dayjs.utc(datum[timestampKey]).toISOString()
+ datum[timestampKey] = iso
+ return datum
+ })
+ }
+
if (timeseriesData.length <= 1 && !(min || max)) return timeseriesData
const dates: unknown[] = timeseriesData.map((datum) => dayjs.utc(datum[timestampKey]))
diff --git a/apps/studio/components/ui/Charts/BarChart.tsx b/apps/studio/components/ui/Charts/BarChart.tsx
index aa2ec9766b6..addd36773ad 100644
--- a/apps/studio/components/ui/Charts/BarChart.tsx
+++ b/apps/studio/components/ui/Charts/BarChart.tsx
@@ -111,11 +111,7 @@ const BarChart = ({
title={title}
format={format}
customDateFormat={customDateFormat}
- highlightedValue={
- typeof resolvedHighlightedValue === 'number'
- ? numberFormatter(resolvedHighlightedValue, valuePrecision)
- : resolvedHighlightedValue
- }
+ highlightedValue={resolvedHighlightedValue}
highlightedLabel={resolvedHighlightedLabel}
minimalHeader={minimalHeader}
/>