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 2020/08/04 13:59:06 UTC

[GitHub] [incubator-echarts] pissang commented on a change in pull request #12236: fix #9265 axis name overlapped with axis labels for `grid.containLabel: true`

pissang commented on a change in pull request #12236:
URL: https://github.com/apache/incubator-echarts/pull/12236#discussion_r465070440



##########
File path: src/component/axis/AxisBuilder.js
##########
@@ -269,7 +269,22 @@ var builders = {
         var nameLocation = axisModel.get('nameLocation');
         var nameDirection = opt.nameDirection;
         var textStyleModel = axisModel.getModel('nameTextStyle');
-        var gap = axisModel.get('nameGap') || 0;
+        // label + gap
+        var distanceToAxis = calcDistanceToAxis();
+        function calcDistanceToAxis() {
+          var axis = axisModel.axis;
+          if (axis.grid.model.get('containLabel') && !axis.model.get('axisLabel.inside')) {
+            var labelUnionRect = estimateLabelUnionRect(axis);

Review comment:
       AxisBuilder can also be used on coordinate systems other than grids. In which case, axis.grid may be null. And access grid model in the axis builder is an abstraction leak.




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

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