New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Highcharts reflow not happend to x-axis #7814

Closed
ipip2005 opened this Issue Feb 7, 2018 · 3 comments

Comments

Projects
None yet
3 participants
@ipip2005

ipip2005 commented Feb 7, 2018

Expected behaviour

x-axis is reflowed when calling chart.reflow()

Actual behaviour

x-axis is not reflowed properly when calling chart.reflow()

Live demo with steps to reproduce

http://jsfiddle.net/644syxw3/

  1. Click 'Toggle' and 'Reflow' several times.

image

Product version

5.0.13

Affected browser(s)

Chrome

@KacperMadej

This comment has been minimized.

Contributor

KacperMadej commented Feb 7, 2018

Hi @ipip2005

Thank you for reporting.

The problem is also visible in the current (6.0.6) and github code version.

@KacperMadej KacperMadej added the Bug label Feb 7, 2018

@pawelfus

This comment has been minimized.

Contributor

pawelfus commented Feb 7, 2018

Workaround:
Reflow title manually on redraw/load chart events: http://jsfiddle.net/BlackLabel/644syxw3/6/

function resizeTitle(axis) {
  axis.axisTitle.css({
    width: axis.len
  });
}

var chart = Highcharts.chart('container', {
  chart: {
    events: {
      load: function() {
        resizeTitle(this.xAxis[0]);
      },
      redraw: function() {
        resizeTitle(this.xAxis[0]);
      }
    }
  },
  ...
});

Internal note:
In the demo above, when rendering title, axis.pos equals 380, but after chart is fully rendered, this axis.pos is equal to 319. Missing 61pixels are later added to chart.plotLeft, so I assume it's space needed by yAxis title and labels. Auto-wrapping xAxis title was added in 321e025 commit.

@ipip2005 ipip2005 closed this Feb 8, 2018

@ipip2005 ipip2005 reopened this Feb 8, 2018

@ipip2005

This comment has been minimized.

ipip2005 commented Feb 8, 2018

Closed the issue by accident, reopened it now.

Thanks for the workaround!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment