Skip to content

Instantly share code, notes, and snippets.

@aboutaaron
Created October 4, 2012 20:22
Show Gist options
  • Save aboutaaron/3836183 to your computer and use it in GitHub Desktop.
Save aboutaaron/3836183 to your computer and use it in GitHub Desktop.
Shitty load in IE6-9?
tooltip: {
useHTML: true,
formatter: function() {
// This is using the Highcharts tooltip API plus the JS ternary operator to conditionally add tooltips to the accumulated gross
// http://stackoverflow.com/a/7344366/868724
return this.x + "<br>" + this.series.name + ': <strong>$' + Highcharts.numberFormat(this.y) + '</strong>' + ( typeof this.point.weeks !== "undefined" ? "<br>Weeks in box office: " + this.point.weeks : "" )
},
@aboutaaron
Copy link
Author

Well, this part:

( typeof this.point.weeks !== "undefined" ? "<br>Weeks in box office: " + this.point.weeks : "" )

@aboutaaron
Copy link
Author

Using the ternary operator, If this.point.weeks does not evaluate as undefined, return this string, else, return an empty one. Now, why wouldn't IE like this?

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