Skip to content

Commit

Permalink
feat ⚡️: adjust left margin
Browse files Browse the repository at this point in the history
  • Loading branch information
squiles committed Nov 29, 2024
1 parent fffca2f commit 4d791db
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 27 deletions.
11 changes: 2 additions & 9 deletions app/charts/bar/bars-grouped-state.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@ import {
PADDING_WITHIN,
} from "@/charts/bar/constants";
import {
useAxisLabelHeightOffset,
useChartBounds,
useChartPadding,
} from "@/charts/shared/chart-dimensions";
Expand Down Expand Up @@ -341,17 +340,11 @@ const useBarsGroupedState = (
: yTimeRangeDomainLabels,
});
const right = 40;
const { offset: yAxisLabelMargin } = useAxisLabelHeightOffset({
label: xMeasure.label,
width,
marginLeft: left,
marginRight: right,
});
const margins = {
top: 50 + yAxisLabelMargin,
top: 0,
right,
bottom,
left,
left: 50 + left,
};
const bounds = useChartBounds(width, margins, height);
const { chartWidth, chartHeight } = bounds;
Expand Down
11 changes: 2 additions & 9 deletions app/charts/bar/bars-stacked-state.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@ import {
} from "@/charts/bar/bars-stacked-state-props";
import { PADDING_INNER, PADDING_OUTER } from "@/charts/bar/constants";
import {
useAxisLabelHeightOffset,
useChartBounds,
useChartPadding,
} from "@/charts/shared/chart-dimensions";
Expand Down Expand Up @@ -401,17 +400,11 @@ const useBarsStackedState = (
normalize,
});
const right = 40;
const { offset: yAxisLabelMargin } = useAxisLabelHeightOffset({
label: xMeasure.label,
width,
marginLeft: left,
marginRight: right,
});
const margins = {
top: 50 + yAxisLabelMargin,
top: 0,
right,
bottom,
left,
left: 50 + left,
};
const bounds = useChartBounds(width, margins, height);
const { chartWidth, chartHeight } = bounds;
Expand Down
12 changes: 3 additions & 9 deletions app/charts/bar/bars-state.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@ import {
} from "@/charts/bar/bars-state-props";
import { PADDING_INNER, PADDING_OUTER } from "@/charts/bar/constants";
import {
useAxisLabelHeightOffset,
useChartBounds,
useChartPadding,
} from "@/charts/shared/chart-dimensions";
Expand Down Expand Up @@ -203,17 +202,12 @@ const useBarsState = (
: yTimeRangeDomainLabels,
});
const right = 40;
const { offset: xAxisLabelMargin } = useAxisLabelHeightOffset({
label: xMeasure.label,
width,
marginLeft: left,
marginRight: right,
});
const margins = {
top: 50 + xAxisLabelMargin,
top: 0,
right,
bottom,
left,
//NOTE: hardcoded for the moment
left: 50 + left,
};

const bounds = useChartBounds(width, margins, height);
Expand Down

0 comments on commit 4d791db

Please sign in to comment.