DopeMax commented on issue #8269: 关系图normal状态下label.rotate字段配置无响应 URL: https://github.com/apache/incubator-echarts/issues/8269#issuecomment-429840359 > > @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); > } > } @liuswin 非常感谢
---------------------------------------------------------------- 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]
