1

I had this original question HighCharts: How to use reflow to allow auto-resize after changing size

Where the answer I got was this block of code below:

if (!vs.chartObject.reflowNow) {
    vs.chartObject.reflowNow = vs.chartObject.reflowNow = function() {
        this.containerHeight = this.options.chart.height || window.window.HighchartsAdapter.adapterRun(this.renderTo, 'height');
        this.containerWidth  = this.options.chart.width  || window.window.HighchartsAdapter.adapterRun(this.renderTo, 'width');

        if (vs.expandedType === 'max') {
            this.setSize(this.containerWidth, (this.containerHeight-220), true);
        } else {
            this.setSize(this.containerWidth, this.containerHeight, true);
        }

        this.hasUserSize = null;
    }
 }

 vs.chartObject.reflowNow();

However now for some reason I'm getting undefined on this: window.window.HighchartsAdapter

Which breaks my chart expand code now.

When I console logged window.window and expanded it, I can see that there is no longer a HighchartsAdapter.

enter image description here

Do any of you HighChart developers know which method replaces HighchartsAdapter now?

enter image description here

Community
  • 1
  • 1
Leon Gaban
  • 36,509
  • 115
  • 332
  • 529

1 Answers1

4

Since 4.2.1 HighchartsAdapter is removed from the core. That means Highcharts lib doesn't depend on jQuery or any other library anymore.

In the source of old versions you can find that method:

adapterRun: function (elem, method) {
    return $(elem)[method]();
},

That means, if you are using jQuery, you can replace:

window.window.HighchartsAdapter.adapterRun(this.renderTo, 'height')

with:

$(this.renderTo).height();

And to be honest, you always could use that solution - it's more readable than using adapterRun().

Paweł Fus
  • 44,795
  • 3
  • 61
  • 77