Skip to content

Plotline events no longer bind this to plotline #20516

@charmbv

Description

@charmbv

Expected behaviour

I'm using the following code to handle the mouseover and mouseout events on a plotline to display a tooltip:

chart.yAxis[0].addPlotLine({
  ...,
  events: {
    mouseover: function (event: any) {
      console.log(this);
      return MyComponent.prototype.showTargetPlotLineTooltip(this, event);
    },
    mouseout: function (event: any) {
      console.log(this);
      return MyComponent.prototype.hideTargetPlotLineTooltip(this, event);
    },
  },
});

When hovering over the plotline the tooltip should appear and disappear again when moving away from the plotline. Also, the console should show a PlotlineOrBand object.

Actual behaviour

The console shows the target element of the event and the show/hide functions fail that series is not a member of undefined for the line:

const series: Highcharts.Series = plotLine.axis.series[0];

When I donwgrade Highcharts to v11.1.0 the problem disappears.

Product version

Highcharts v11.2.0, Highcharts-Angular v4.0.0

Affected browser(s)

Firefox, Chrome, Edge.

Metadata

Metadata

Assignees

Type

No type

Projects

Status

Done

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions