Skip to content

Instantly share code, notes, and snippets.

@julian-boolean
Last active December 7, 2022 17:49
Show Gist options
  • Star 7 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save julian-boolean/8339982 to your computer and use it in GitHub Desktop.
Save julian-boolean/8339982 to your computer and use it in GitHub Desktop.
dynamically resize rickshaw chart.
$(window).on('resize', function(){
graph.configure({
width: window.innerWidth - 20,
height: window.innerHeight - 20
});
graph.render();
});
@wangshijun
Copy link

the resize callback should have be throttled

@ceremcem
Copy link

ceremcem commented Dec 7, 2022

You can also directly use the width and height of the parent div by document.getElementById('mychart').getBoundingClientRect() and use .width and .height properties of the result.

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