You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@echarts.apache.org by sh...@apache.org on 2020/06/22 08:24:04 UTC
[incubator-echarts] branch label-enhancement updated: feat(pie):
support overflow wrap
This is an automated email from the ASF dual-hosted git repository.
shenyi pushed a commit to branch label-enhancement
in repository https://gitbox.apache.org/repos/asf/incubator-echarts.git
The following commit(s) were added to refs/heads/label-enhancement by this push:
new 804a99c feat(pie): support overflow wrap
804a99c is described below
commit 804a99c668e8a178761060135cfcf8379bd34f25
Author: pissang <bm...@gmail.com>
AuthorDate: Mon Jun 22 16:23:22 2020 +0800
feat(pie): support overflow wrap
---
src/chart/pie/PieSeries.ts | 1 +
src/chart/pie/labelLayout.ts | 1 -
src/label/labelGuideHelper.ts | 2 +-
test/pie-label-extreme.html | 8 ++++++--
4 files changed, 8 insertions(+), 4 deletions(-)
diff --git a/src/chart/pie/PieSeries.ts b/src/chart/pie/PieSeries.ts
index d2b3c18..5ed642b 100644
--- a/src/chart/pie/PieSeries.ts
+++ b/src/chart/pie/PieSeries.ts
@@ -247,6 +247,7 @@ class PieSeriesModel extends SeriesModel<PieSeriesOption> {
// If rotate around circle
rotate: 0,
show: true,
+ overflow: 'truncate',
// 'outer', 'inside', 'center'
position: 'outer',
// 'none', 'labelLine', 'edge'. Works only when position is 'outer'
diff --git a/src/chart/pie/labelLayout.ts b/src/chart/pie/labelLayout.ts
index 3458873..14b8c3b 100644
--- a/src/chart/pie/labelLayout.ts
+++ b/src/chart/pie/labelLayout.ts
@@ -197,7 +197,6 @@ function avoidOverlap(
// TODOTODO
// layout.text = textContain.truncateText(layout.text, targetTextWidth, layout.font);
layout.label.style.width = targetTextWidth;
- layout.label.style.overflow = 'truncate';
if (layout.labelAlignTo === 'edge') {
realTextWidth = targetTextWidth;
// realTextWidth = textContain.getWidth(layout.text, layout.font);
diff --git a/src/label/labelGuideHelper.ts b/src/label/labelGuideHelper.ts
index bc14b44..1614b39 100644
--- a/src/label/labelGuideHelper.ts
+++ b/src/label/labelGuideHelper.ts
@@ -408,7 +408,7 @@ const tmpProjPoint = new Point();
* @param minTurnAngle Radian of minimum turn angle. 0 - 180
*/
export function limitTurnAngle(linePoints: number[][], minTurnAngle: number) {
- if (!(minTurnAngle < 180 && minTurnAngle > 0)) {
+ if (!(minTurnAngle <= 180 && minTurnAngle > 0)) {
return;
}
minTurnAngle = minTurnAngle / 180 * Math.PI;
diff --git a/test/pie-label-extreme.html b/test/pie-label-extreme.html
index 1fcee55..e919d8a 100644
--- a/test/pie-label-extreme.html
+++ b/test/pie-label-extreme.html
@@ -681,12 +681,14 @@ under the License.
labelLine: {
length: 15,
length2: 15,
- smooth: 0.3
+ smooth: 0.3,
+ minTurnAngle: 110
},
label: {
margin: 25,
bleedMargin: 10,
- alignTo: 'none'
+ alignTo: 'none',
+ overflow: 'truncate'
}
};
@@ -706,10 +708,12 @@ under the License.
labelFolder.open();
labelLineFolder.open();
labelFolder.add(config.label, 'alignTo', ['none', 'edge', 'labelLine']).onChange(update);
+ labelFolder.add(config.label, 'overflow', ['truncate', 'wrap']).onChange(update);
labelFolder.add(config.label, 'margin', 0, 50).onChange(update);
labelFolder.add(config.label, 'bleedMargin', 0, 500).onChange(update);
labelLineFolder.add(config.labelLine, 'length', 0, 500).onChange(update);
labelLineFolder.add(config.labelLine, 'length2', 0, 500).onChange(update);
+ labelLineFolder.add(config.labelLine, 'minTurnAngle', 0, 180).onChange(update);
labelLineFolder.add(config.labelLine, 'smooth', 0, 1).onChange(update);
});
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@echarts.apache.org
For additional commands, e-mail: commits-help@echarts.apache.org