Skip to content

Commit c86b9ce

Browse files
committed
Revert "fix(legend): Fix text overflow and improve layout handling. (#20237)"
This reverts commit ed9013d.
1 parent 23d287a commit c86b9ce

File tree

3 files changed

+9
-162
lines changed

3 files changed

+9
-162
lines changed

src/component/legend/LegendView.ts

Lines changed: 7 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -132,15 +132,15 @@ class LegendView extends ComponentView {
132132
selectorPosition = orient === 'horizontal' ? 'end' : 'start';
133133
}
134134

135+
this.renderInner(itemAlign, legendModel, ecModel, api, selector, orient, selectorPosition);
136+
135137
// Perform layout.
136138
const refContainer = layoutUtil.createBoxLayoutReference(legendModel, api).refContainer;
137139
const positionInfo = legendModel.getBoxLayoutParams();
138140
const padding = legendModel.get('padding');
139141

140142
const maxSize = layoutUtil.getLayoutRect(positionInfo, refContainer, padding);
141143

142-
this.renderInner(itemAlign, legendModel, ecModel, api, selector, orient, selectorPosition, maxSize);
143-
144144
const mainRect = this.layoutInner(legendModel, itemAlign, maxSize, isFirstRender, selector, selectorPosition);
145145

146146
// Place mainGroup, based on the calculated `mainRect`.
@@ -179,8 +179,7 @@ class LegendView extends ComponentView {
179179
api: ExtensionAPI,
180180
selector: LegendSelectorButtonOption[],
181181
orient: LegendOption['orient'],
182-
selectorPosition: LegendOption['selectorPosition'],
183-
maxSize: layoutUtil.LayoutRect,
182+
selectorPosition: LegendOption['selectorPosition']
184183
) {
185184
const contentGroup = this.getContentGroup();
186185
const legendDrawnMap = zrUtil.createHashMap();
@@ -228,8 +227,7 @@ class LegendView extends ComponentView {
228227
const itemGroup = this._createItem(
229228
seriesModel, name, dataIndex,
230229
legendItemModel, legendModel, itemAlign,
231-
lineVisualStyle, style, legendIcon, selectMode, api,
232-
maxSize,
230+
lineVisualStyle, style, legendIcon, selectMode, api
233231
);
234232

235233
itemGroup.on('click', curry(dispatchSelectAction, name, null, api, excludeSeriesId))
@@ -284,8 +282,7 @@ class LegendView extends ComponentView {
284282
const itemGroup = this._createItem(
285283
seriesModel, name, dataIndex,
286284
legendItemModel, legendModel, itemAlign,
287-
{}, style, legendIcon, selectMode, api,
288-
maxSize,
285+
{}, style, legendIcon, selectMode, api
289286
);
290287

291288
// FIXME: consider different series has items with the same name.
@@ -396,8 +393,7 @@ class LegendView extends ComponentView {
396393
itemVisualStyle: PathStyleProps,
397394
legendIcon: string,
398395
selectMode: LegendOption['selectedMode'],
399-
api: ExtensionAPI,
400-
maxSize: layoutUtil.LayoutRect,
396+
api: ExtensionAPI
401397
) {
402398
const drawType = seriesModel.visualDrawType;
403399
const itemWidth = legendModel.get('itemWidth');
@@ -479,8 +475,7 @@ class LegendView extends ComponentView {
479475
y: itemHeight / 2,
480476
fill: textColor,
481477
align: textAlign,
482-
verticalAlign: 'middle',
483-
width: maxSize.width - textX,
478+
verticalAlign: 'middle'
484479
}, {inheritColor: textColor})
485480
}));
486481

src/component/legend/ScrollableLegendView.ts

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -114,13 +114,12 @@ class ScrollableLegendView extends LegendView {
114114
api: ExtensionAPI,
115115
selector: LegendSelectorButtonOption[],
116116
orient: ScrollableLegendOption['orient'],
117-
selectorPosition: ScrollableLegendOption['selectorPosition'],
118-
maxSize: layoutUtil.LayoutRect,
117+
selectorPosition: ScrollableLegendOption['selectorPosition']
119118
) {
120119
const self = this;
121120

122121
// Render content items.
123-
super.renderInner(itemAlign, legendModel, ecModel, api, selector, orient, selectorPosition, maxSize);
122+
super.renderInner(itemAlign, legendModel, ecModel, api, selector, orient, selectorPosition);
124123

125124
const controllerGroup = this._controllerGroup;
126125

test/legend-overflow.html

Lines changed: 0 additions & 147 deletions
This file was deleted.

0 commit comments

Comments
 (0)