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/03/27 11:19:06 UTC
[incubator-echarts] 02/02: refact: fix truncate and breadcrumb text
in treemap.
This is an automated email from the ASF dual-hosted git repository.
shenyi pushed a commit to branch next
in repository https://gitbox.apache.org/repos/asf/incubator-echarts.git
commit a555834a7ff17815ad9de3acd5bb86fb2e5822b1
Author: pissang <bm...@gmail.com>
AuthorDate: Fri Mar 27 19:18:18 2020 +0800
refact: fix truncate and breadcrumb text in treemap.
---
src/chart/treemap/Breadcrumb.ts | 16 ++++++++++++----
src/chart/treemap/TreemapView.ts | 5 +++++
2 files changed, 17 insertions(+), 4 deletions(-)
diff --git a/src/chart/treemap/Breadcrumb.ts b/src/chart/treemap/Breadcrumb.ts
index 94f7715..6d8d5f5 100644
--- a/src/chart/treemap/Breadcrumb.ts
+++ b/src/chart/treemap/Breadcrumb.ts
@@ -165,15 +165,23 @@ class Breadcrumb {
style: defaults(
normalStyleModel.getItemStyle(),
{
- lineJoin: 'bevel',
- text: text,
- textFill: textStyleModel.getTextColor(),
- textFont: textStyleModel.getFont()
+ lineJoin: 'bevel'
}
),
+ textContent: new graphic.Text({
+ style: {
+ text,
+ fill: textStyleModel.getTextColor(),
+ font: textStyleModel.getFont()
+ }
+ }),
+ textConfig: {
+ position: 'inside'
+ },
z: 10,
onclick: curry(onSelect, itemNode)
});
+
this.group.add(el);
packEventData(el, seriesModel, itemNode);
diff --git a/src/chart/treemap/TreemapView.ts b/src/chart/treemap/TreemapView.ts
index 77c8f86..e94ffad 100644
--- a/src/chart/treemap/TreemapView.ts
+++ b/src/chart/treemap/TreemapView.ts
@@ -966,6 +966,11 @@ function renderNode(
}
);
+ const textEl = rectEl.getTextContent();
+ textEl.style.overflow = 'truncate';
+ textEl.style.truncateMinChar = 2;
+ textEl.style.width = width;
+
// TODOTODO
// upperLabelRect && (normalStyle.textRect = clone(upperLabelRect));
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@echarts.apache.org
For additional commands, e-mail: commits-help@echarts.apache.org