@@ -58,7 +58,7 @@ export function BarChart({
5858 style,
5959 warningPrefix
6060} : BarChartProps ) : ReactElement | null {
61- const [ chartDimensions , setChartDimensions ] = useState < { height : number ; width : number } > ( ) ;
61+ const [ chartDimensions , setChartDimensions ] = useState < { height ? : number ; width ? : number } > ( ) ;
6262
6363 const warningMessagePrefix = useMemo ( ( ) => ( warningPrefix ? warningPrefix + "i" : "I" ) , [ warningPrefix ] ) ;
6464
@@ -133,16 +133,7 @@ export function BarChart({
133133 }
134134
135135 return < VictoryStack colorScale = { normalizedBarColors } > { bars } </ VictoryStack > ;
136- } , [
137- dataTypesResult ,
138- series ,
139- style ,
140- warningMessagePrefix ,
141- sortProps ,
142- showLabels ,
143- normalizedBarColors ,
144- presentation
145- ] ) ;
136+ } , [ dataTypesResult , series , style , sortProps , showLabels , normalizedBarColors , presentation ] ) ;
146137
147138 const [ firstSeries ] = series ;
148139
@@ -195,8 +186,8 @@ export function BarChart({
195186 ( event : LayoutChangeEvent ) => {
196187 const { height, width } = event . nativeEvent . layout ;
197188 setChartDimensions ( {
198- height : height <= 0 ? - 1 : height ,
199- width : width <= 0 ? - 1 : width
189+ height : height <= 0 ? undefined : height ,
190+ width : width <= 0 ? undefined : width
200191 } ) ;
201192 } ,
202193 [ setChartDimensions ]
@@ -222,8 +213,8 @@ export function BarChart({
222213 // horizontal charts.
223214 < VictoryChart
224215 domainPadding = { { x : style . domain ?. padding ?. y , y : style . domain ?. padding ?. x } }
225- height = { chartDimensions ? .height }
226- width = { chartDimensions ? .width }
216+ height = { chartDimensions . height }
217+ width = { chartDimensions . width }
227218 padding = { aggregateGridPadding ( style . grid ) }
228219 scale = {
229220 dataTypesResult
0 commit comments