Skip to content

Commit

Permalink
Added Formatting text feature to ToolTips (#184)
Browse files Browse the repository at this point in the history
  • Loading branch information
techlabz authored Oct 28, 2024
1 parent 2667a9f commit 625ea4f
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion src/charts/line/Tooltip.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,11 @@ import { getXPositionForCurve } from './utils/getXPositionForCurve';
import { getYForX } from 'react-native-redash';
import { useLineChart } from './useLineChart';
import { useMemo } from 'react';
import type { TFormatterFn } from '../candle/types';

export type LineChartTooltipProps = Animated.AnimateProps<ViewProps> & {
children?: React.ReactNode;
format?: TFormatterFn<string>;
xGutter?: number;
yGutter?: number;
cursorGutter?: number;
Expand All @@ -38,6 +40,7 @@ LineChartTooltip.displayName = 'LineChartTooltip';

export function LineChartTooltip({
children,
format,
xGutter = 8,
yGutter = 8,
cursorGutter = 48,
Expand Down Expand Up @@ -171,7 +174,7 @@ export function LineChartTooltip({
]}
>
{children || (
<LineChartPriceText index={at} style={[textStyle]} {...textProps} />
<LineChartPriceText format={format} index={at} style={[textStyle]} {...textProps} />
)}
</Animated.View>
);
Expand Down

0 comments on commit 625ea4f

Please sign in to comment.