Ovilia commented on code in PR #17212:
URL: https://github.com/apache/echarts/pull/17212#discussion_r908005681


##########
src/component/axis/AxisBuilder.ts:
##########
@@ -420,10 +420,26 @@ const builders: Record<'axisLine' | 'axisTickLabel' | 
'axisName', AxisElementsBu
 
         const textFont = textStyleModel.getFont();
 
+        const coordSysModel = axisModel.getCoordSysModel();
+        const coordSys = coordSysModel ? coordSysModel.coordinateSystem : null;
+
         const truncateOpt = axisModel.get('nameTruncate', true) || {};
-        const ellipsis = truncateOpt.ellipsis;
+        const ellipsis = textStyleModel.get('ellipsis') || 
truncateOpt.ellipsis;
+        const overflow = textStyleModel.get('overflow') || 'none';
+
+        let nameTruncateDefaultWidth;
+
+        if (overflow !== 'none') {
+            nameTruncateDefaultWidth = Math.abs(extent[1] - extent[0]); // 
Current axis length.
+            if (!isNameLocationCenter(nameLocation)) {
+                const rect = coordSys && coordSys.getRect && 
coordSys.getRect();
+                nameTruncateDefaultWidth = rect ? rect.width : 
nameTruncateDefaultWidth * 2;

Review Comment:
   It's odd to use `nameTruncateDefaultWidth * 2` because is this is assuming 
we are using polar coordinate. @pissang @100pah Please help further review this 
PR.



##########
src/component/axis/AxisBuilder.ts:
##########
@@ -420,10 +420,26 @@ const builders: Record<'axisLine' | 'axisTickLabel' | 
'axisName', AxisElementsBu
 
         const textFont = textStyleModel.getFont();
 
+        const coordSysModel = axisModel.getCoordSysModel();
+        const coordSys = coordSysModel ? coordSysModel.coordinateSystem : null;
+
         const truncateOpt = axisModel.get('nameTruncate', true) || {};
-        const ellipsis = truncateOpt.ellipsis;
+        const ellipsis = textStyleModel.get('ellipsis') || 
truncateOpt.ellipsis;
+        const overflow = textStyleModel.get('overflow') || 'none';
+
+        let nameTruncateDefaultWidth;
+
+        if (overflow !== 'none') {
+            nameTruncateDefaultWidth = Math.abs(extent[1] - extent[0]); // 
Current axis length.
+            if (!isNameLocationCenter(nameLocation)) {

Review Comment:
   Why should centered name not using ellipsis?



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to