Skip to content

Commit 4c7fe42

Browse files
authored
fix(charts - TypeScript): correct interval type (#5785)
1 parent 86e568a commit 4c7fe42

File tree

6 files changed

+12
-11
lines changed

6 files changed

+12
-11
lines changed

packages/charts/src/components/BarChart/BarChart.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ import {
1616
XAxis,
1717
YAxis
1818
} from 'recharts';
19+
import type { YAxisProps } from 'recharts';
1920
import { getValueByDataKey } from 'recharts/lib/util/ChartUtils.js';
2021
import { useCancelAnimationFallback } from '../../hooks/useCancelAnimationFallback.js';
2122
import { useChartMargin } from '../../hooks/useChartMargin.js';
@@ -81,9 +82,8 @@ interface MeasureConfig extends IChartMeasure {
8182
interface DimensionConfig extends IChartDimension {
8283
/**
8384
* Interval of dimension axis labels
84-
* @default 0
8585
*/
86-
interval?: number;
86+
interval?: YAxisProps['interval'];
8787
}
8888

8989
export interface BarChartProps extends IChartBaseProps {

packages/charts/src/components/BulletChart/BulletChart.tsx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ import {
1515
XAxis,
1616
YAxis
1717
} from 'recharts';
18+
import type { YAxisProps } from 'recharts';
1819
import { useChartMargin } from '../../hooks/useChartMargin.js';
1920
import { useLabelFormatter } from '../../hooks/useLabelFormatter.js';
2021
import { useLegendItemClick } from '../../hooks/useLegendItemClick.js';
@@ -69,7 +70,7 @@ interface MeasureConfig extends IChartMeasure {
6970
}
7071

7172
interface DimensionConfig extends IChartDimension {
72-
interval?: number;
73+
interval?: YAxisProps['interval'];
7374
}
7475

7576
export interface BulletChartProps extends IChartBaseProps {

packages/charts/src/components/ColumnChart/ColumnChart.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ import {
1616
XAxis,
1717
YAxis
1818
} from 'recharts';
19+
import type { YAxisProps } from 'recharts';
1920
import { getValueByDataKey } from 'recharts/lib/util/ChartUtils.js';
2021
import { useCancelAnimationFallback } from '../../hooks/useCancelAnimationFallback.js';
2122
import { useChartMargin } from '../../hooks/useChartMargin.js';
@@ -64,9 +65,8 @@ interface MeasureConfig extends IChartMeasure {
6465
interface DimensionConfig extends IChartDimension {
6566
/**
6667
* Interval of axis label
67-
* @default 0
6868
*/
69-
interval?: number;
69+
interval?: YAxisProps['interval'];
7070
}
7171

7272
export interface ColumnChartProps extends IChartBaseProps {

packages/charts/src/components/ColumnChartWithTrend/ColumnChartWithTrend.tsx

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
import { ThemingParameters, useIsomorphicId } from '@ui5/webcomponents-react-base';
44
import type { CSSProperties } from 'react';
55
import React, { forwardRef } from 'react';
6-
import type { TooltipProps } from 'recharts';
6+
import type { TooltipProps, YAxisProps } from 'recharts';
77
import { useLongestYAxisLabel } from '../../hooks/useLongestYAxisLabel.js';
88
import { usePrepareDimensionsAndMeasures } from '../../hooks/usePrepareDimensionsAndMeasures.js';
99
import { usePrepareTrendMeasures } from '../../hooks/usePrepareTrendMeasures.js';
@@ -44,9 +44,8 @@ interface MeasureConfig extends IChartMeasure {
4444
interface DimensionConfig extends IChartDimension {
4545
/**
4646
* Interval of axis label which defines the number that controls how many ticks are rendered on the x axis
47-
* @default 0
4847
*/
49-
interval?: number;
48+
interval?: YAxisProps['interval'];
5049
}
5150

5251
export interface ColumnChartWithTrendProps

packages/charts/src/components/ComposedChart/index.tsx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ import {
1818
XAxis,
1919
YAxis
2020
} from 'recharts';
21+
import type { YAxisProps } from 'recharts';
2122
import { getValueByDataKey } from 'recharts/lib/util/ChartUtils.js';
2223
import { useChartMargin } from '../../hooks/useChartMargin.js';
2324
import { useLabelFormatter } from '../../hooks/useLabelFormatter.js';
@@ -77,7 +78,7 @@ interface MeasureConfig extends IChartMeasure {
7778
}
7879

7980
interface DimensionConfig extends IChartDimension {
80-
interval?: number;
81+
interval?: YAxisProps['interval'];
8182
}
8283

8384
export interface ComposedChartProps extends IChartBaseProps {

packages/charts/src/components/LineChart/LineChart.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
import { enrichEventWithDetails, ThemingParameters, useIsRTL, useSyncRef } from '@ui5/webcomponents-react-base';
44
import React, { forwardRef, useCallback, useRef } from 'react';
5-
import type { LineProps } from 'recharts';
5+
import type { LineProps, YAxisProps } from 'recharts';
66
import {
77
Brush,
88
CartesianGrid,
@@ -58,7 +58,7 @@ interface MeasureConfig extends IChartMeasure {
5858
}
5959

6060
interface DimensionConfig extends IChartDimension {
61-
interval?: number;
61+
interval?: YAxisProps['interval'];
6262
}
6363

6464
export interface LineChartProps extends IChartBaseProps {

0 commit comments

Comments
 (0)