Skip to content

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

fix chart widths (#28181)

Jordi Enric03f37bce408a
diff --git a/apps/studio/components/interfaces/SQLEditor/UtilityPanel/UtilityPanel.tsx b/apps/studio/components/interfaces/SQLEditor/UtilityPanel/UtilityPanel.tsx
index e442bd55a10..5bdb190a3c4 100644
--- a/apps/studio/components/interfaces/SQLEditor/UtilityPanel/UtilityPanel.tsx
+++ b/apps/studio/components/interfaces/SQLEditor/UtilityPanel/UtilityPanel.tsx
@@ -99,7 +99,7 @@ const UtilityPanel = ({
const chartConfig = getChartConfig()
function onConfigChange(config: ChartConfig) {
- if (!ref || !snippet.id) return
+ if (!ref || !snippet?.id) return
upsertContent({
projectRef: ref,
diff --git a/apps/studio/components/to-be-cleaned/Charts/ChartHandler.tsx b/apps/studio/components/to-be-cleaned/Charts/ChartHandler.tsx
index dee56127db3..9d0bb216d1d 100644
--- a/apps/studio/components/to-be-cleaned/Charts/ChartHandler.tsx
+++ b/apps/studio/components/to-be-cleaned/Charts/ChartHandler.tsx
@@ -167,6 +167,9 @@ const ChartHandler = ({
</div>
{chartStyle === 'bar' ? (
<BarChart
+ YAxisProps={{
+ width: 1,
+ }}
data={(chartData?.data ?? []) as any}
format={format || chartData?.format}
xAxisKey={'period_start'}
diff --git a/apps/studio/components/ui/Charts/BarChart.tsx b/apps/studio/components/ui/Charts/BarChart.tsx
index 76c5e95991b..ea05d94ae0e 100644
--- a/apps/studio/components/ui/Charts/BarChart.tsx
+++ b/apps/studio/components/ui/Charts/BarChart.tsx
@@ -68,6 +68,7 @@ const BarChart = ({
const _YAxisProps = YAxisProps || {
tickFormatter: (value) => numberFormatter(value, valuePrecision),
tick: false,
+ width: 0,
}
const day = (value: number | string) => (displayDateInUtc ? dayjs(value).utc() : dayjs(value))
@@ -121,12 +122,6 @@ const BarChart = ({
<Container>
<RechartBarChart
data={data}
- margin={{
- top: 0,
- right: 0,
- left: -58, // [Joshen] 120724 Not sure why bar charts have a weird left margin suddenly, but this is a temp fix
- bottom: 0,
- }}
className="overflow-visible"
// mouse hover focusing logic
onMouseMove={(e: any) => {