This is an automated email from the ASF dual-hosted git repository. wangzx pushed a commit to branch fix/radar-name in repository https://gitbox.apache.org/repos/asf/echarts.git
commit 306a400d0987c53083b891eb351c77fbce4af26f Author: plainheart <[email protected]> AuthorDate: Fri Jul 5 16:26:13 2024 +0800 fix(radar): fix radar name overflow --- src/component/axis/AxisBuilder.ts | 7 +++++-- src/coord/radar/RadarModel.ts | 1 + test/radar.html | 13 ++++++++++--- 3 files changed, 16 insertions(+), 5 deletions(-) diff --git a/src/component/axis/AxisBuilder.ts b/src/component/axis/AxisBuilder.ts index 1644d5024..c5a024ed8 100644 --- a/src/component/axis/AxisBuilder.ts +++ b/src/component/axis/AxisBuilder.ts @@ -425,7 +425,10 @@ const builders: Record<'axisLine' | 'axisTickLabel' | 'axisName', AxisElementsBu const truncateOpt = axisModel.get('nameTruncate', true) || {}; const ellipsis = truncateOpt.ellipsis; const maxWidth = retrieve( - opt.nameTruncateMaxWidth, truncateOpt.maxWidth, axisNameAvailableWidth + textStyleModel.get('width') as number, + opt.nameTruncateMaxWidth, + truncateOpt.maxWidth, + axisNameAvailableWidth ); const textEl = new graphic.Text({ @@ -436,7 +439,7 @@ const builders: Record<'axisLine' | 'axisTickLabel' | 'axisName', AxisElementsBu style: createTextStyle(textStyleModel, { text: name, font: textFont, - overflow: 'truncate', + overflow: textStyleModel.get('overflow' as any) || 'truncate', width: maxWidth, ellipsis, fill: textStyleModel.getTextColor() diff --git a/src/coord/radar/RadarModel.ts b/src/coord/radar/RadarModel.ts index e3728c110..c9b164894 100644 --- a/src/coord/radar/RadarModel.ts +++ b/src/coord/radar/RadarModel.ts @@ -146,6 +146,7 @@ class RadarModel extends ComponentModel<RadarOption> implements CoordinateSystem nameGap: nameGap, // min: 0, nameTextStyle: iNameTextStyle, + nameRotate: nameTextStyle.rotate, triggerEvent: triggerEvent } as InnerIndicatorAxisOption, false); if (zrUtil.isString(nameFormatter)) { diff --git a/test/radar.html b/test/radar.html index 64e4e31bf..8752bd0bb 100644 --- a/test/radar.html +++ b/test/radar.html @@ -53,9 +53,16 @@ under the License. }, radar: { radius: [50, '70%'], - name: { - formatter:'【{value}】', - color:'#72ACD1' + axisName: { + formatter:'【{value}】11', + color:'#72ACD1', + width: 50, + textBorderColor: 'red', + textBorderWidth: 1, + textShadowColor: 'cyan', + textShadowBlur: 5, + ellipsis: 'aaa', + rotate: 50 }, triggerEvent: true, // shape: 'circle', --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
