Ticket #8055 (closed defect: fixed)

Opened 2 months ago

Last modified 8 weeks ago

Charting hangs browser when canvas is 0x0

Reported by: jaredj Owned by: elazutkin
Priority: normal Milestone: 1.2.2
Component: Charting Version: 1.2.1
Severity: normal Keywords:
Cc:

Description

From a co-worker:

While trying to use charts within a floating pane widget I discovered that when the pane was "docked" and the chart's render() was called, the browser would lock up. After a little debug I figured out the problem was due to a canvas size of 0x0. This eventually leads to an infinite loop (divide by zero) in dojox.charting.scaler.linear at line 183:

while(while(next <= scaler.bounds.to + 1/scaler.bounds.scale){...}

Change History

Changed 2 months ago by elazutkin

  • priority changed from high to normal
  • status changed from new to assigned
  • severity changed from major to normal

"Invisible" charts are not supported --- all browsers have various problems with them on the gfx level. I'll fix the calculation when NaN was produced but it will not help the case, unless the chart will be completely redrawn when visible. But if the co-worker will put this logic in place, s/he can easily suppress generation of "invisible" chart as well.

Changed 2 months ago by elazutkin

  • status changed from assigned to closed
  • resolution set to worksforme

I went to fixed the loop and ... it appears I fixed it already in the trunk. Please try with the trunk and reopen the ticket, if the problem still persist.

Changed 2 months ago by jaredj

From my co-worker (A suggestion to make it behave saner, possibly):

Thanks. In the case of floating panes, I found the problem was being caused by a resize() call to the docked widget (with negative width and height!) but I could not determine what event this call was coming from. I am able to work around the problem by overriding the resize() function in the Chart2d widget with

resize: function(box){

if(box.w > 0 && box.h > 0){ this.inherited(arguments); }

}

Perhaps they could do something similar in the Chart2d widget as a simple fix for cases like this?

Changed 2 months ago by elazutkin

  • status changed from closed to reopened
  • resolution deleted
  • milestone changed from tbd to 1.2.2

Yep, the resize fix sounds totally reasonable, thank you for the info. I'll push this change tonight.

And could you split off the widget for this "negative" resize for the Dijit team? Something is clearly wrong on their side of the resize business.

Changed 2 months ago by jaredj

Will do. Ill try to get more info/testcase on where the negative resize occurs and get that to the dijit folks.

If you can tell me the files (or heck, send me the .patch), for the change you put into 1.2.2, that would be awesome as I can pull it in earlier here for my co-wroker. If not, I can just diff the branch and figure it out anyway, so no worries if you won't have time to gen an actual patchfile.

Changed 8 weeks ago by elazutkin

  • status changed from reopened to closed
  • resolution set to fixed

I'll push the change to the trunk and to 1.2.2 (thx Adam Peller for bringing it to my attention!).

Trac is acting up --- closing this ticket manually. Still it needs to be reported to the Dijit team.

Changed 8 weeks ago by elazutkin

Sorry: the change was pushed to both repositories.

Note: See TracTickets for help on using tickets.