100pah commented on issue #9265: xAxis.nameGap and yAxis.nameGap should be set 
automatically given grid.containLabel
URL: 
https://github.com/apache/incubator-echarts/issues/9265#issuecomment-434022070
 
 
   Currenly `containLabel` only considered axis labels, but not consider axis 
name.
   
   @jbadilla 
   
   
![](https://user-images.githubusercontent.com/25373337/47557879-17660200-d912-11e8-983f-ffd9eca0c64e.png)
   This axis lable is visually unpleasant because the default `nameGap` is `0`.
   
   Another issue #9286 gave a related situation that the axis name might 
overflow the rendering area.
   
   To make the layout wisely, I think two enhancements can be taken into accout 
(and the two enhancement might be independent with each other in 
implementation):
   
   ### (A) Enhanse the layout calculation of axis name: adjust it based on axis 
label and viewport.
   
   Keep the current behaviors of `nameLocation` and `nameGap`, and add a new 
option `nameLocationAdjust` (or some likely name), which enable axis name to be 
auto adjusted to avoid interfering with axis labels and overflow the viewport, 
following the strategy below:
   
   **Procedure X:**
   Layout axis name by the given `nameLoation` and `nameGap`, and then adjust 
it to avoid interfering with axis labels. Finally the relative location of axis 
name with axis line get.  Detailedly, in this case, `nameGap` is not the gap 
with axis line any more, but actually is the gap with the bounding rect of both 
axis line and axis labels. 
   
   Procedure X will be executed twices if `containLabel` is set, the same as 
current implementation:
       1. The first execution is before the "coordinate system update stage", 
based on the estinamed axis label layout.
       2. The second execution is on the "cartesian rendering stage", based on 
the accrate axis label layout.
   
   **Procedure Y:**
   Ajust the axis name to avoid overflowing the viewport (if it makes the axis 
name interfere with axis labels again, leave them there). Notice the overflow 
also need to be taken into account when `nameLocation` is `start` or `end`, 
like #9286 issued, which enables that when two cartesian exists axes align with 
each other without dynamic axis names overflow.
   
   Procedure Y is only be executed in the "cartesian rendering stage", after 
Procedure X executed.
   
   
   ### (B) Enhanse the cartesian rect determine calculation when `containLabel`
   Currently `containLabel` has considdered axis label (and rotation). We 
should make it take into account the located axis name also, whatever the (A) 
is implemented or not. 
   
   But the logic looks not neat, a little complecated :(
   
    

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
[email protected]


With regards,
Apache Git Services

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

Reply via email to