score:1

Accepted answer

You can correct data-labels positions by using the attr method on their SVG elements.

For example:

  chart: {
    events: {
      render: function() {
        const series = this.series;
        const dl1 = series[3].points[0].dataLabel;
        const dl2 = series[4].points[0].dataLabel;

        if (dl1.y + dl1.height > dl2.y) {
          dl2.attr({
            y: dl1.y + dl1.height
          });
        }
      }
    }
  }

Live demo: https://jsfiddle.net/BlackLabel/5Lmh4owb/

API Reference:

https://api.highcharts.com/class-reference/Highcharts.SVGElement.html#attr

https://api.highcharts.com/highcharts/chart.events.render


Related Articles