Skip to content

Commit

Permalink
fix(chart): fix text padding and line weight
Browse files Browse the repository at this point in the history
  • Loading branch information
Deahrunt committed Apr 12, 2024
1 parent 9bfe4a7 commit 0927695
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 4 deletions.
4 changes: 3 additions & 1 deletion packages/chart/src/components/CoordX.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@ interface ICoordXProps {
size: SharedValue<{height: number; width: number}>;
}

const textPadding = 4;

export const CoordX = ({font, size, coords, index, colors}: ICoordXProps) => {
const path = useDerivedValue(() => {
const path =
Expand All @@ -32,7 +34,7 @@ export const CoordX = ({font, size, coords, index, colors}: ICoordXProps) => {
});

const y = useDerivedValue(() => {
return size.value.height;
return size.value.height - textPadding; //Прижимаю текст слегка наверх, чтобы не обрезался
});

return (
Expand Down
4 changes: 2 additions & 2 deletions packages/chart/src/components/Coordinates.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -78,8 +78,8 @@ export const Coordinates = ({
path={coordinatesPath}
style="stroke"
strokeJoin="round"
strokeWidth={2}
color={colors.BorderHard}
strokeWidth={1}
color={colors.BorderNormal}
/>
{coords.value.coordinateValuesY.map((_, index) => {
return (
Expand Down
2 changes: 1 addition & 1 deletion packages/chart/src/utils/constants.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
export const chartPaddingHorizontal = 40;
export const chartPaddingVertical = 30;
export const chartPaddingVertical = 40; //Увеличил паддинг на 10, слегка сжав график, чтобы влезал текст под Х координатой
export const defaultChartHeightDivider = 4;
export const COLORS = [
'#E0F5E9',
Expand Down

0 comments on commit 0927695

Please sign in to comment.