Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(treemap): label position not work with rich. close #17591 #17740

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 9 additions & 4 deletions src/chart/treemap/TreemapView.ts
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,7 @@ import { ColorString, ECElement } from '../../util/types';
import { windowOpen } from '../../util/format';
import { TextStyleProps } from 'zrender/src/graphic/Text';
import { setLabelStyle, getLabelStatesModels } from '../../label/labelStyle';
import { calculateTextPosition, TextPositionCalculationResult } from 'zrender/src/contain/text';

const Group = graphic.Group;
const Rect = graphic.Rect;
Expand Down Expand Up @@ -1001,10 +1002,14 @@ function renderNode(
(upperLabelRect ? upperLabelRect.height : rectEl.shape.height) - textPadding[0] - textPadding[2], 0
);
if (textStyle.width !== width || textStyle.height !== height) {
textEl.setStyle({
width,
height
});
const {textConfig} = rectEl;
const res = calculateTextPosition(
{} as TextPositionCalculationResult,
textConfig,
textConfig.layoutRect ?? new BoundingRect(0, 0, 0, 0)
);

textEl.setStyle(res);
}
};

Expand Down
97 changes: 97 additions & 0 deletions test/treemap-option-label-position-with-rich.html

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading