diff --git a/src/chart/treemap/TreemapSeries.ts b/src/chart/treemap/TreemapSeries.ts index efc0f06aa1..8822ed0fe7 100644 --- a/src/chart/treemap/TreemapSeries.ts +++ b/src/chart/treemap/TreemapSeries.ts @@ -55,7 +55,7 @@ interface BreadcrumbItemStyleOption extends ItemStyleOption { } interface TreemapSeriesLabelOption extends SeriesLabelOption { - ellipsis?: boolean + ellipsis?: string formatter?: string | ((params: CallbackDataParams) => string) } @@ -306,7 +306,7 @@ class TreemapSeriesModel extends SeriesModel { upperLabel: { show: true, position: [0, '50%'], - ellipsis: true, + ellipsis: '...', verticalAlign: 'middle' } }, diff --git a/src/component/title/install.ts b/src/component/title/install.ts index c7e0678a02..fb5126d11b 100644 --- a/src/component/title/install.ts +++ b/src/component/title/install.ts @@ -158,7 +158,8 @@ class TitleView extends ComponentView { const textEl = new graphic.Text({ style: createTextStyle(textStyleModel, { text: titleModel.get('text'), - fill: textStyleModel.getTextColor() + fill: textStyleModel.getTextColor(), + lineOverflow: textStyleModel.get('lineOverflow') }, {disableBox: true}), z2: 10 }); @@ -171,7 +172,8 @@ class TitleView extends ComponentView { text: subText, fill: subtextStyleModel.getTextColor(), y: textRect.height + titleModel.get('itemGap'), - verticalAlign: 'top' + verticalAlign: 'top', + lineOverflow: textStyleModel.get('lineOverflow') }, {disableBox: true}), z2: 10 }); diff --git a/src/label/labelStyle.ts b/src/label/labelStyle.ts index def6b19f1b..82721078f0 100644 --- a/src/label/labelStyle.ts +++ b/src/label/labelStyle.ts @@ -462,7 +462,7 @@ const TEXT_PROPS_WITH_GLOBAL = [ 'textShadowColor', 'textShadowBlur', 'textShadowOffsetX', 'textShadowOffsetY' ] as const; const TEXT_PROPS_SELF = [ - 'align', 'lineHeight', 'width', 'height', 'tag', 'verticalAlign' + 'align', 'lineHeight', 'width', 'height', 'tag', 'verticalAlign', 'lineOverflow', 'ellipsis' ] as const; const TEXT_PROPS_BOX = [ 'padding', 'borderWidth', 'borderRadius', 'borderDashOffset', diff --git a/src/util/types.ts b/src/util/types.ts index 82a691fee0..1d690e047b 100644 --- a/src/util/types.ts +++ b/src/util/types.ts @@ -1109,6 +1109,8 @@ export interface LabelOption extends TextCommonOption { // formatter?: string | ((params: CallbackDataParams) => string) rich?: Dictionary + lineOverflow?: 'truncate' + ellipsis?: string } export interface SeriesLabelOption extends LabelOption {