Skip to content
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
Closed

Highcharts reflow not happend to x-axis #7814

ipip2005 opened this issue Feb 7, 2018 · 3 comments
Labels

Comments

@ipip2005
Copy link

@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
Copy link
Contributor

@KacperMadej 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.

@pawelfus
Copy link
Contributor

@pawelfus 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
Copy link
Author

@ipip2005 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
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
3 participants