Chart.js icon indicating copy to clipboard operation
Chart.js copied to clipboard

v2.5.0 performance issue?

Open activeperception opened this issue 9 years ago • 12 comments

Hi,

My simple app (angular2) is noticeable slower (loading?/rendering? not sure) after updating to 2.5.0. Anyone experiencing the same issue?

I'll try to put together a jsfiddle.

activeperception avatar Feb 17 '17 08:02 activeperception

@activeperception please put together a fiddle. I don't think we've done anything to make it slower. Which version did you upgrade from?

etimberg avatar Feb 17 '17 23:02 etimberg

Yes this is true, it even crashing browser. But it's okay after downgrading to 2.4.0

frdteknikelektro avatar Feb 25 '17 03:02 frdteknikelektro

@frdteknikelektro do you have a test case we can debug?

etimberg avatar Feb 25 '17 04:02 etimberg

Here, , , I think the problem is when you try to render Chart in parent that display style is none.

https://jsfiddle.net/frdteknikelektro/9pgs9qo9/ <-- Using 2.4 Try to change it to 2.5

frdteknikelektro avatar Feb 25 '17 12:02 frdteknikelektro

Looks like what's happening is that the chart renders even though it has no size. That shouldn't happen

etimberg avatar Feb 25 '17 14:02 etimberg

So what do you think? It's okay from until 2.5

frdteknikelektro avatar Feb 25 '17 15:02 frdteknikelektro

Yes, I'm not sure what changed in 2.5 to change this. I'm looking through the history to see

etimberg avatar Feb 25 '17 15:02 etimberg

@simonbrunel thoughts on this?

etimberg avatar Apr 01 '17 23:04 etimberg

Seems to be caused by the time scale (loop over scaleSizeInUnits == 2674800000 at construction time - update). The chart has no size, but still need to be updated so I guess this issue needs to be fixed at the time scale level.

Maybe @tredston can have a look since the time scale implementation changes a lot in #3914 and might have fixed this issue as well.

simonbrunel avatar Apr 02 '17 08:04 simonbrunel

Looks like me.width has changed in this example case from 0 to be negative, which results in the tickUnit staying on milliseconds instead of bumping up to larger intervals.

Unfortunately it looks like the negative width causes #3914 to get stuck in an infinite loop.

Edit: Seems like this change causes the y-axis to have a positive width, while before it was set to me.maxWidth = 0. This scale's width ends up making the chart's width negative when calculating the layout.

tredston avatar Apr 02 '17 14:04 tredston

Seems indeed that this problem persists only when using the time scale . I had to search everywhere and remove all display:none props from the chart container in order to solve the freezing problem.

andr31 avatar Apr 03 '17 13:04 andr31

Resolved in #4105

etimberg avatar May 02 '17 01:05 etimberg