@@ -6,6 +6,7 @@ import type { CSSProperties } from 'react';
6
6
import { forwardRef } from 'react' ;
7
7
import { PolarAngleAxis , RadialBar , RadialBarChart } from 'recharts' ;
8
8
import { useOnClickInternal } from '../../hooks/useOnClickInternal.js' ;
9
+ import type { IChartBaseProps } from '../../interfaces/IChartBaseProps.js' ;
9
10
import { ChartContainer } from '../../internal/ChartContainer.js' ;
10
11
import { PieChartPlaceholder } from '../PieChart/Placeholder.js' ;
11
12
@@ -17,8 +18,9 @@ interface RadialChartConfig {
17
18
18
19
[ rest : string ] : any ;
19
20
}
20
- //todo expose `loading`
21
- export interface RadialChartProps extends Omit < CommonProps , 'onClick' | 'children' | 'onLegendClick' > {
21
+ export interface RadialChartProps
22
+ extends Omit < CommonProps , 'onClick' | 'children' | 'onLegendClick' > ,
23
+ Pick < IChartBaseProps , 'loading' | 'loadingDelay' > {
22
24
/**
23
25
* The actual value which defines how much the ring is filled.
24
26
*/
@@ -92,6 +94,8 @@ const defaultDisplayValueStyles = {
92
94
*/
93
95
const RadialChart = forwardRef < HTMLDivElement , RadialChartProps > ( ( props , ref ) => {
94
96
const {
97
+ loading,
98
+ loadingDelay,
95
99
maxValue = 100 ,
96
100
value,
97
101
displayValue,
@@ -108,7 +112,7 @@ const RadialChart = forwardRef<HTMLDivElement, RadialChartProps>((props, ref) =>
108
112
} = props ;
109
113
110
114
const range = [ 0 , maxValue ] ;
111
- const dataset = [ { value } ] ;
115
+ const dataset = typeof value === 'number' ? [ { value } ] : [ ] ;
112
116
113
117
const onDataPointClickInternal = ( payload , i , event ) => {
114
118
if ( payload && onDataPointClick ) {
@@ -126,8 +130,8 @@ const RadialChart = forwardRef<HTMLDivElement, RadialChartProps>((props, ref) =>
126
130
127
131
return (
128
132
< ChartContainer
129
- loading = { undefined }
130
- loadingDelay = { undefined }
133
+ loading = { loading }
134
+ loadingDelay = { loadingDelay }
131
135
dataset = { dataset }
132
136
ref = { ref }
133
137
Placeholder = { PieChartPlaceholder }
0 commit comments