question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Manually trigger window resize event doesn't cause charts to resize

See original GitHub issue

First of all, thanks for building these beautiful charts, and forgive me if I am wrong.

I manually trigger window resize event with

    $(window).trigger('resize')

However, this doesn’t cause chart.js charts to reize.

Any advice will be appreciated, thanks in advance 😃

Issue Analytics

  • State:closed
  • Created 9 years ago
  • Comments:5 (2 by maintainers)

github_iconTop GitHub Comments

1reaction
evildeltacommented, Feb 13, 2017

If you trigger the on-resize you can add your chart to the call like this.

$( window ).resize(function() { myChart.resize(); });

I fired the event using this, as I put the chart in a slideToggle div and to redisplay, in the onComplete function I added var evt = document.createEvent(‘UIEvents’); evt.initUIEvent(‘resize’, true, false,window,0); window.dispatchEvent(evt);

0reactions
rizqinizamilcommented, Dec 8, 2014

@nnnick - Anyway, why chart doesn’t show in bootstrap modal when I set responsive options is true? I shout resize browser manually then chart will came up.

Read more comments on GitHub >

github_iconTop Results From Across the Web

How to trigger the window resize event in JavaScript?
It only triggers event listeners that have been added using jQuery. In my case, a 3rd party library was listening directly to the...
Read more >
A problem with resizing a dxChart - DevExpress Support
The idea from this was to call browser window resize event manually, so the graph would think the browser is resized and would...
Read more >
Responsive Charts - Chart.js
To support resizing charts when printing, you need to hook the onbeforeprint (opens new window) event and manually trigger resizing of each ...
Read more >
Window: resize event - Web APIs | MDN
The resize event fires when the document view (window) has been resized. This event is not cancelable and does not bubble.
Read more >
Trigger window's resize event with JavaScript/jQuery
1. Using jQuery. In jQuery, you can trigger the window resize event using the .trigger() method.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found