File tree 2 files changed +7
-8
lines changed
2 files changed +7
-8
lines changed Original file line number Diff line number Diff line change @@ -5,7 +5,6 @@ import useSlotProps from '@mui/utils/useSlotProps';
5
5
import composeClasses from '@mui/utils/composeClasses' ;
6
6
import { useThemeProps , useTheme , styled } from '@mui/material/styles' ;
7
7
import { useRtl } from '@mui/system/RtlProvider' ;
8
- import { getDefaultBaseline , getDefaultTextAnchor } from '../ChartsText/defaultTextPlacement' ;
9
8
import { clampAngle } from '../internals/clampAngle' ;
10
9
import { useIsHydrated } from '../hooks/useIsHydrated' ;
11
10
import { doesTextFitInRect , ellipsize } from '../internals/ellipsize' ;
Original file line number Diff line number Diff line change @@ -6,7 +6,7 @@ import composeClasses from '@mui/utils/composeClasses';
6
6
import { useThemeProps , styled , useTheme } from '@mui/material/styles' ;
7
7
import { useRtl } from '@mui/system/RtlProvider' ;
8
8
import { getDefaultBaseline , getDefaultTextAnchor } from '../ChartsText/defaultTextPlacement' ;
9
- import { ellipsize } from '../internals/ellipsize' ;
9
+ import { doesTextFitInRect , ellipsize } from '../internals/ellipsize' ;
10
10
import { useIsClient } from '../hooks/useIsClient' ;
11
11
import { getStringSize } from '../internals/domUtils' ;
12
12
import { TickItemType , useTicks } from '../hooks/useTicks' ;
@@ -80,15 +80,15 @@ function shortenLabels(
80
80
bottomBoundModifier ,
81
81
) ;
82
82
83
- shortenedLabels . set (
84
- item ,
85
- ellipsize ( item . formattedValue . toString ( ) , {
83
+ const doesTextFit = ( text : string ) =>
84
+ doesTextFitInRect ( text , {
86
85
width : maxWidth ,
87
86
height,
88
87
angle,
89
- measureText : ( text ) => getStringSize ( text , tickLabelStyle ) ,
90
- } ) ,
91
- ) ;
88
+ measureText : ( string : string ) => getStringSize ( string , tickLabelStyle ) ,
89
+ } ) ;
90
+
91
+ shortenedLabels . set ( item , ellipsize ( item . formattedValue . toString ( ) , doesTextFit ) ) ;
92
92
}
93
93
}
94
94
You can’t perform that action at this time.
0 commit comments