pissang commented on code in PR #16880:
URL: https://github.com/apache/echarts/pull/16880#discussion_r851845679


##########
src/coord/cartesian/Grid.ts:
##########
@@ -202,10 +200,32 @@ class Grid implements CoordinateSystemMaster {
                     }
                 }
             });
-
+            //Adjust grid.width to keep xAxis labels in dom
+            const [xAxis, yAxis] = axesList[0].isHorizontal() ? axesList : 
axesList.slice().reverse();

Review Comment:
   > The function labelUnionRect actually returns the largest bounding box of 
all labels of an axis, not the union bounding box
   The method `estimateLabelUnionRect` returns the union bounding box of all 
labels, not the largest.
   
   > so it would be hard to get the real size of displayed bounding box of 
labels because echarts seems to automatically clip labels according to axis 
length
   
   I'm not sure what do you mean by clip labels. Correct me if I'm wrong. 
Indeed we only pick some of the labels if there are amount of theme, especially 
in category axis.
   
https://github.com/apache/echarts/blob/4a52199842039d7fa6019ee8584d1a395fbc771a/src/coord/axisHelper.ts#L324
   Perhaps the last label will also be skipped. We can add some extra logic to 
ensure the first label and last label are also included.
   
   



##########
src/coord/cartesian/Grid.ts:
##########
@@ -202,10 +200,32 @@ class Grid implements CoordinateSystemMaster {
                     }
                 }
             });
-
+            //Adjust grid.width to keep xAxis labels in dom
+            const [xAxis, yAxis] = axesList[0].isHorizontal() ? axesList : 
axesList.slice().reverse();

Review Comment:
   > The function labelUnionRect actually returns the largest bounding box of 
all labels of an axis, not the union bounding box
   
   The method `estimateLabelUnionRect` returns the union bounding box of all 
labels, not the largest.
   
   > so it would be hard to get the real size of displayed bounding box of 
labels because echarts seems to automatically clip labels according to axis 
length
   
   I'm not sure what do you mean by clip labels. Correct me if I'm wrong. 
Indeed we only pick some of the labels if there are amount of theme, especially 
in category axis.
   
https://github.com/apache/echarts/blob/4a52199842039d7fa6019ee8584d1a395fbc771a/src/coord/axisHelper.ts#L324
   Perhaps the last label will also be skipped. We can add some extra logic to 
ensure the first label and last label are also included.
   
   



-- 
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