From f3400355b0a1eeab0e8583b322aab74d51d0f748 Mon Sep 17 00:00:00 2001 From: Vinay Gupta Date: Tue, 7 Jan 2025 11:04:57 +0530 Subject: [PATCH] Enhance label customization by passing `label` prop to `labelComponent` This change allows users to pass the `label` prop directly to the `labelComponent`, enabling external customization of the label rendering. Previously, the `labelComponent` was static and did not accept dynamic input for the label text. With this update, users can now manage the label component and customize its content, style, or behavior outside the `LineChart` component. This flexibility is useful when users need to apply custom rendering logic or styles to the labels based on their application-specific requirements. ### Changes: - Modified `labelComponent` to accept the `label` prop as an argument, allowing it to be passed from the parent. - Updated the rendering logic for both static and animated labels to use the updated `labelComponent` signature. --- src/LineChart/index.tsx | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/LineChart/index.tsx b/src/LineChart/index.tsx index 6aa57c7..e06cb22 100644 --- a/src/LineChart/index.tsx +++ b/src/LineChart/index.tsx @@ -560,7 +560,7 @@ export const LineChart = (props: LineChartPropsType) => { rotateLabel && {transform: [{rotate: '60deg'}]}, ]}> {labelComponent ? ( - labelComponent() + labelComponent(label) ) : ( { rotateLabel && {transform: [{rotate: '60deg'}]}, ]}> {labelComponent ? ( - labelComponent() + labelComponent(label) ) : (