Accepted answer

from highcharts api:


reflows the chart to its container. by default, the chart reflows automatically to its container following a window.resize event, as per the chart.reflow option. however, there are no reliable events for div resize, so if the container is resized without a window resize event, this must be called explicitly.

as a solution, call reflow method after width change.

  useeffect(() => {
    const chart = chartcomponent.current?.chart;

    if (chart) chart.reflow(false);
  }, [width]);

live demo:

api reference:

Related Query

More Query from same tag