Skip to content
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

Chart does not draw if animation.duration = 0 #1910

Closed
mathiask88 opened this issue Jan 18, 2016 · 4 comments
Closed

Chart does not draw if animation.duration = 0 #1910

mathiask88 opened this issue Jan 18, 2016 · 4 comments
Milestone

Comments

@mathiask88
Copy link
Contributor

If I create a static chart with an inital dataset and animations turned off the chart is not drawn. If the window is resized the chart is displayed sometimes. 2.0-dev

@mathiask88
Copy link
Contributor Author

I found the bug. Sometimes there was an onresize event triggered although the size did not change. And the resize function set a new width to the canvas which is equivalent to clearRect.

I fixed this by returning the resize function if the size did not really change.

diff --git src/core/core.controller.js src/core/core.controller.js
index e4da7af..c0487fb 100644
--- src/core/core.controller.js
+++ src/core/core.controller.js
@@ -90,12 +90,15 @@

            var sizeChanged = this.chart.width !== newWidth || this.chart.height !== newHeight;

+           if (!sizeChanged)
+               return this;
+
            canvas.width = this.chart.width = newWidth;
            canvas.height = this.chart.height = newHeight;

            helpers.retinaScale(this.chart);

-           if (!silent && sizeChanged) {
+           if (!silent) {
                this.stop();
                this.update(this.options.responsiveAnimationDuration);
            }

@etimberg
Copy link
Member

Fixed in #1911

@etimberg etimberg added this to the Version 2.0 milestone Jan 18, 2016
@mathiask88
Copy link
Contributor Author

Maybe also fixes #1904?

@etimberg
Copy link
Member

It might. I'll leave a comment on it

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

No branches or pull requests

2 participants