Skip to content

Commit

Permalink
Merge pull request #3555 from VisActor/fix/tooltip-position-and-style
Browse files Browse the repository at this point in the history
Fix/tooltip position and style
  • Loading branch information
xile611 authored Dec 13, 2024
2 parents 8d93109 + 388e002 commit a8ed299
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 1 deletion.
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
{
"changes": [
{
"comment": "fix: fix style of dom tooltip\n\n",
"type": "none",
"packageName": "@visactor/vchart"
}
],
"packageName": "@visactor/vchart",
"email": "[email protected]"
}
Original file line number Diff line number Diff line change
Expand Up @@ -240,6 +240,7 @@ export class DomTooltipHandler extends BaseTooltipHandler {

if (contentDom && hasContent) {
const columnDivs = [...(contentDom.children as any)] as HTMLElement[];
setStyleToDom(contentDom, { whiteSpace: 'nowrap' });

columnDivs.forEach((colDiv, index) => {
const colName = colDiv.getAttribute('data-col');
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ export const getScale = (element: HTMLElement, boundingClientRect?: DOMRect) =>
if (element.offsetWidth > 0) {
return boundingClientRect.width / element.offsetWidth;
}
return boundingClientRect.height / element.offsetHeight;
return element.offsetHeight > 0 ? boundingClientRect.height / element.offsetHeight : 1;
};

export const formatContent = (content: any) => {
Expand Down

0 comments on commit a8ed299

Please sign in to comment.