Check out this StackBlitz demo I created: https://stackblitz.com/edit/ng-tootltip-ocdngb?file=src/app/bar-chart.ts
In my Angular app, I have integrated a D3 chart.
The bars on the chart display tooltips when hovered over.
However, on smaller screens, the tooltip appears in the center of the window.
To achieve this, I need to calculate the width of the tooltip using:
const toolTipWidth = tooltip.node().getBoundingClientRect().width;
Everything works perfectly in the demo, but when I implement it in my actual Angular CLI application, I encounter the following error:
error TS2339: Property 'getBoundingClientRect' does not exist on type 'BaseType'.
Property 'getBoundingClientRect' does not exist on type 'Window'.
What is causing this error and how can I resolve it?