Skip to content

Commit 5d21bf9

Browse files
committed
fix: tooltip should not render empty column when hasShape of tooltip is false, related to #3572
1 parent 42330c7 commit 5d21bf9

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

packages/vchart/src/plugin/components/tooltip-handler/dom-tooltip-handler.ts

+4-1
Original file line numberDiff line numberDiff line change
@@ -246,9 +246,11 @@ export class DomTooltipHandler extends BaseTooltipHandler {
246246
const colName = colDiv.getAttribute('data-col');
247247

248248
if (colName && columns.includes(colName)) {
249+
const hideColumn = colName === 'shape' && content.every(c => !c.hasShape || !c.shapeType);
250+
249251
setStyleToDom(colDiv, {
250252
...(this._domStyle as any)[colName],
251-
display: 'inline-block',
253+
display: hideColumn ? 'none' : 'inline-block',
252254
verticalAlign: 'top'
253255
});
254256
const rows = [...(colDiv.children as any)] as HTMLElement[];
@@ -280,6 +282,7 @@ export class DomTooltipHandler extends BaseTooltipHandler {
280282
styleByRow = { ...styleByRow, ...getTextStyle(entry.valueStyle) };
281283
}
282284
} else if (colName === 'shape') {
285+
styleByRow.display = entry.hasShape ? 'inline-block' : 'none';
283286
row.innerHTML = getSvgHtml(entry);
284287
}
285288

0 commit comments

Comments
 (0)