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

Setting title: {useHTML: true, text: null} throws an error #7316

Closed
sweetro opened this Issue Oct 24, 2017 · 3 comments

Comments

Projects
None yet
4 participants
@sweetro

sweetro commented Oct 24, 2017

Expected behaviour

Based on the documentation, should not show title when {title: {text: null}} (assume this will be the case regardless of other parameters).

Actual behaviour

Errors on {title: {text: null, useHTML: true}}

highcharts.js:51 Uncaught TypeError: Cannot read property 'toString' of null
    at a.SVGElement.getBBox (VM274 highcharts.js:51)
    at a.Chart.<anonymous> (VM274 highcharts.js:236)
    at Array.forEach (<anonymous>)
    at a.each (VM274 highcharts.js:28)
    at a.Chart.layOutTitles (VM274 highcharts.js:236)
    at a.Chart.setTitle (VM274 highcharts.js:236)
    at a.Chart.render (VM274 highcharts.js:251)
    at a.Chart.firstRender (VM274 highcharts.js:255)
    at a.Chart.init (VM274 highcharts.js:230)
    at a.Chart.getArgs (VM274 highcharts.js:229)

Doing a bit of digging it looks like this occurs because the svgElement that is set for title when useHTML is true has a textStr element that is set to null whereas when useHTML is false or undefined the textStr element is undefined. getBBox checks if textStr is undefined, but doesn't check null so errors on the null.toString.

Live demo with steps to reproduce

http://jsfiddle.net/8kqrqkb4/1/

Affected browser(s)

Probably All (Tested Chrome and FF) Highcharts v 6.0.2

@pawelfus

This comment has been minimized.

Show comment
Hide comment
@pawelfus

pawelfus Oct 25, 2017

Contributor

Hi @sweetro

Thank you for reporting the issue!

Contributor

pawelfus commented Oct 25, 2017

Hi @sweetro

Thank you for reporting the issue!

@TorsteinHonsi

This comment has been minimized.

Show comment
Hide comment
@TorsteinHonsi

TorsteinHonsi Nov 1, 2017

Collaborator

@KacperMadej

Thanks for fixing! However the test fails in Edge and IE11:
skjermbilde 2017-11-01 kl 15 13 17

Collaborator

TorsteinHonsi commented Nov 1, 2017

@KacperMadej

Thanks for fixing! However the test fails in Edge and IE11:
skjermbilde 2017-11-01 kl 15 13 17

@KacperMadej

This comment has been minimized.

Show comment
Hide comment
@KacperMadej

KacperMadej Nov 10, 2017

Contributor

Resolved through 7ed92fb

Contributor

KacperMadej commented Nov 10, 2017

Resolved through 7ed92fb

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