Search code examples
highchartsannotationsjstockchart

Responsiveness of the annotations in highcharts


without full screen

on full screen

In StockChart of highcharts whenever I use Measure (X,Y,XY) annotation and switch to full screen, the annotation does not reflow or is not consistent with the scale.

Is there a way to correct that?

https://www.highcharts.com/stock/demo/stock-tools-gui


Solution

  • That problem is a bug in Highcharts and it is reported here: https://github.com/highcharts/highcharts/issues/11174

    As a workaround, you can update measure annotations in redraw event:

    chart: {
        events: {
            redraw: function() {
                this.annotations.forEach(function(annotation) {
                    if (annotation.options.type === 'measure') {
                        annotation.update();
                    }
                });
            }
        }
    }
    

    Live demo: https://jsfiddle.net/BlackLabel/xc6eo0f7/

    API Reference: https://api.highcharts.com/highcharts/chart.events.redraw