File tree Expand file tree Collapse file tree 3 files changed +16
-12
lines changed
packages/charts/react-charts/library/src
components/CommonComponents Expand file tree Collapse file tree 3 files changed +16
-12
lines changed Original file line number Diff line number Diff line change
1
+ {
2
+ "type" : " patch" ,
3
+ "comment" : " fix v9 bugs" ,
4
+ "packageName" : " @fluentui/react-charts" ,
5
+
6
+ "dependentChangeType" : " patch"
7
+ }
Original file line number Diff line number Diff line change @@ -52,7 +52,9 @@ export const CartesianChart: React.FunctionComponent<ModifiedCartesianChartProps
52
52
const _isFirstRender = React . useRef < boolean > ( true ) ;
53
53
// eslint-disable-next-line @typescript-eslint/no-explicit-any
54
54
let _xScale : any ;
55
- let isIntegralDataset : boolean = true ;
55
+ const isIntegralDataset = React . useMemo ( ( ) => {
56
+ return ! props . points . some ( ( point : { y : number } ) => point . y % 1 !== 0 ) ;
57
+ } , [ props . points ] ) ;
56
58
let _tooltipId : string = useId ( 'tooltip_' ) ;
57
59
/* Used for when WrapXAxisLabels props appeared.
58
60
* To display the total word (space separated words), Need to have more space than usual.
@@ -141,8 +143,6 @@ export const CartesianChart: React.FunctionComponent<ModifiedCartesianChartProps
141
143
} else if ( startFromX !== 0 ) {
142
144
setStartFromX ( 0 ) ;
143
145
}
144
- // eslint-disable-next-line react-hooks/exhaustive-deps
145
- isIntegralDataset = ! props . points . some ( ( point : { y : number } ) => point . y % 1 !== 0 ) ;
146
146
return ( ) => {
147
147
cancelAnimationFrame ( _reqID ) ;
148
148
} ;
@@ -168,10 +168,6 @@ export const CartesianChart: React.FunctionComponent<ModifiedCartesianChartProps
168
168
} else if ( startFromX !== 0 ) {
169
169
setStartFromX ( 0 ) ;
170
170
}
171
- if ( prevProps !== null && prevProps . points !== props . points ) {
172
- // eslint-disable-next-line react-hooks/exhaustive-deps
173
- isIntegralDataset = ! props . points . some ( ( point : { y : number } ) => point . y % 1 !== 0 ) ;
174
- }
175
171
} , [ props , prevProps ] ) ;
176
172
177
173
React . useImperativeHandle (
Original file line number Diff line number Diff line change @@ -1478,16 +1478,17 @@ export function domainRangeOfDateForAreaLineScatterVerticalBarCharts(
1478
1478
// So, Finding smallest and largest dates
1479
1479
sDate = d3Min ( [ ...tickValues , sDate ] ) ! ;
1480
1480
lDate = d3Max ( [ ...tickValues , lDate ] ) ! ;
1481
- } else {
1482
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
1483
- sDate = d3Min ( points as any [ ] , point => point . x as Date ) ! ;
1484
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
1485
- lDate = d3Max ( points as any [ ] , point => point . x as Date ) ! ;
1481
+
1486
1482
if ( hasMarkersMode || chartType === ChartTypes . ScatterChart ) {
1487
1483
const xPadding = getDomainPaddingForMarkers ( sDate . getTime ( ) , lDate . getTime ( ) ) ;
1488
1484
sDate = new Date ( sDate . getTime ( ) - xPadding . start ) ;
1489
1485
lDate = new Date ( lDate . getTime ( ) + xPadding . end ) ;
1490
1486
}
1487
+ } else {
1488
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
1489
+ sDate = d3Min ( points as any [ ] , point => point . x as Date ) ! ;
1490
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
1491
+ lDate = d3Max ( points as any [ ] , point => point . x as Date ) ! ;
1491
1492
}
1492
1493
1493
1494
const rStartValue = margins . left ! ;
You can’t perform that action at this time.
0 commit comments