Skip to content

Positioner not working properly with same logic on two different version #399

@smil-thakur-zeuslearning

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:

image

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:

image

what could be reason for this, and how to do i make a general logic that works on both the versions

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions