You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@echarts.apache.org by GitBox <gi...@apache.org> on 2018/10/15 08:52:24 UTC

[GitHub] liuswin commented on issue #8269: 关系图normal状态下label.rotate字段配置无响应

liuswin commented on issue #8269: 关系图normal状态下label.rotate字段配置无响应
URL: https://github.com/apache/incubator-echarts/issues/8269#issuecomment-429761158
 
 
   > @liuswin 能告诉下是如何添加的吗,方便的话,帮忙贴个代码片段出来,万分感谢。
   
   data.eachItemGraphicEl(function (el, idx) {
     ...
     if (seriesModel.get('data')[idx].label.cusLabelRoate === true) {
       var pos = data.getItemLayout(idx);
       var rad = Math.atan2(pos[1] - cy, pos[0] - cx);
       if (rad < 0) {
           rad = Math.PI * 2 + rad;
       }
       var isLeft = pos[0] < cx;
       if (isLeft) {
           rad = rad - Math.PI;
       }
       var textPosition = isLeft ? 'left' : 'right';
       symbolPath.setStyle({
           textRotation: -rad,
           textPosition: textPosition,
           textOrigin: 'center'
       });
       symbolPath.hoverStyle && (symbolPath.hoverStyle.textPosition = textPosition);
     }
   }

----------------------------------------------------------------
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:
users@infra.apache.org


With regards,
Apache Git Services

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