You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@echarts.apache.org by GitBox <gi...@apache.org> on 2022/04/25 08:13:06 UTC

[GitHub] [echarts] jiawulin001 commented on issue #16940: [Bug] ’width‘ is not work in axis‘s nameTextStyle

jiawulin001 commented on issue #16940:
URL: https://github.com/apache/echarts/issues/16940#issuecomment-1108227649

   ### Problem locating
   This bug is caused because Echarts doesn't seem to be interested in receiving `nameTextStyle` at all.
   Check the class `axisName` below
   https://github.com/apache/echarts/blob/3961cefc0329cfa8782602fc2aea46cc76c3f50e/src/component/axis/AxisBuilder.ts#L367
   And you will find `nameTextStyle.width` is never referred to. Besides the `maxWidth`, the important width parameter passed in to text element maker, gets its value from three variables.
   https://github.com/apache/echarts/blob/3961cefc0329cfa8782602fc2aea46cc76c3f50e/src/component/axis/AxisBuilder.ts#L425-L427
   The first two `opt.nameTruncateMaxWidth`, `truncateOpt.maxWidth` should come from user input but they are nowhere to be found in documentation. While the last one, `axisNameAvailableWidth` is derived from `opt.axisNameAvailableWidth`, another misterious variable. After all, none of them has anything to do with `nameTextStyle.width`. That's why `nameTextStyle.width` would never work. 
   
   ### Solution
   It's an easy fix, just let `axisNameAvailableWidth` get `nameTextStyle.width` if it has no value.
   **Submitting a PR to fix this**


-- 
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: commits-unsubscribe@echarts.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@echarts.apache.org
For additional commands, e-mail: commits-help@echarts.apache.org