From 0927695210d2eef02e4ba99ba43bee2f692833dd Mon Sep 17 00:00:00 2001 From: AlekseySmirnov Date: Fri, 12 Apr 2024 17:58:18 +0500 Subject: [PATCH] fix(chart): fix text padding and line weight --- packages/chart/src/components/CoordX.tsx | 4 +++- packages/chart/src/components/Coordinates.tsx | 4 ++-- packages/chart/src/utils/constants.ts | 2 +- 3 files changed, 6 insertions(+), 4 deletions(-) diff --git a/packages/chart/src/components/CoordX.tsx b/packages/chart/src/components/CoordX.tsx index 9167b7bf..dcc33abe 100644 --- a/packages/chart/src/components/CoordX.tsx +++ b/packages/chart/src/components/CoordX.tsx @@ -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 = @@ -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 ( diff --git a/packages/chart/src/components/Coordinates.tsx b/packages/chart/src/components/Coordinates.tsx index 111c1f27..8e46d331 100644 --- a/packages/chart/src/components/Coordinates.tsx +++ b/packages/chart/src/components/Coordinates.tsx @@ -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 ( diff --git a/packages/chart/src/utils/constants.ts b/packages/chart/src/utils/constants.ts index a84e13c8..873c3ae4 100644 --- a/packages/chart/src/utils/constants.ts +++ b/packages/chart/src/utils/constants.ts @@ -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',