1

In an app that I work I have this scenario: In a responsive container I have a chart. This container is resized at a point and I need to change the chart size by calling the setSize method. But after that I want to make the chart responsive again - to resize on window resize event.

I made a fiddle to demo this: http://jsfiddle.net/7ka4qaef/ First click on the red button, then try to resize the window. Is there anyway to 'forget' that I've used setSize method?

George I.
  • 560
  • 2
  • 7
  • 26

3 Answers3

1

Adding this after your setSize does what you want:

$('#container').highcharts().hasUserSize = false;

Forked JSFiddle

previous query on this: stackoverflow query

Community
  • 1
  • 1
Peter Healy
  • 223
  • 1
  • 9
0

hasUserSize has been removed in newest version of HighCharts.

I managed to do the same with these lines:

chart.options.chart.width = null;
chart.options.chart.height = null;
morten.c
  • 3,414
  • 5
  • 40
  • 45
Dunge
  • 532
  • 3
  • 19
0

i use update function to solve this problem.

this.$refs.highcharts.chart.update({
  chart: {
    width: undefined,
    height: undefined,
  },
});
Sheng
  • 1