Last active
February 11, 2018 21:40
-
-
Save lettergram/f05f839bf7e1c2637ee29db701bde806 to your computer and use it in GitHub Desktop.
Adjust highcharts based on window size
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Highcharts.chart('chart_container', { | |
chart: { | |
events: { | |
load: -> | |
# On mobile, remove labels | |
if $(window).width() < 900 | |
this.yAxis[0].update({ | |
title: false, | |
labels: false | |
}) | |
this.yAxis[1].update({ | |
visible: false | |
} | |
this.tooltip.update({ | |
style: { | |
width: Math.min(300, 2*$(window).width()/3) | |
} | |
}) | |
} | |
}, | |
... |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment