-
Notifications
You must be signed in to change notification settings - Fork 64
Description
VERSION 1: angular 14, angular-highcharts: "^14.1.7"
positioner logic:
positioner: function(labelWidth, labelHeight, point) { // Get the chart position relative to the entire document const chartPosition = this.chart.pointer.getChartPosition(); // Calculate the X position: center of the point let posX = chartPosition.left + point.plotX + this.chart.plotLeft - (labelWidth / 2); // Calculate the Y position: top of the chart area let posY = chartPosition.top + this.chart.plotTop - labelHeight; // If the chart is inside a table or another container, get the container's offset const container = this.chart.container.parentElement; const containerRect = container.getBoundingClientRect(); // Adjust positions based on the container's offset posX -= containerRect.left + window.scrollX; posY -= containerRect.top + window.scrollY; console.log({"posX": posX, "posY": posY}); return { x: posX, y: posY }; },
Result:
VERSION 2: angular 16, angular-highcharts: "16.0.0"
same positioner logic: positioner: function(labelWidth, labelHeight, point) { // Get the chart position relative to the entire document const chartPosition = this.chart.pointer.getChartPosition(); // Calculate the X position: center of the point let posX = chartPosition.left + point.plotX + this.chart.plotLeft - (labelWidth / 2); // Calculate the Y position: top of the chart area let posY = chartPosition.top + this.chart.plotTop - labelHeight; // If the chart is inside a table or another container, get the container's offset const container = this.chart.container.parentElement; const containerRect = container!.getBoundingClientRect(); // Adjust positions based on the container's offset posX -= containerRect.left + window.scrollX; posY -= containerRect.top + window.scrollY; console.log({"posX": posX, "posY": posY}); return { x: posX, y: posY }; },
Result:
what could be reason for this, and how to do i make a general logic that works on both the versions

