My favorites | Sign in
Project Home Downloads Wiki Issues Source
New issue   Search
  Advanced search   Search tips   Subscriptions
Issue 349: endles-loop when DIV is hidden (
3 people starred this issue and may be notified of changes. Back to list
Status:  New
Owner:  ----

Sign in to add a comment
Reported by, Feb 10, 2010
What steps will reproduce the problem?
1. set the style of the DIV containing a timeplot (or any predecessor of
this DIV) to 'display:none'
2. try to load the containing page

What is the expected output? What do you see instead?
The script seems to run in an endless-loop when trying to draw a
timeplot-diagramm, google chrome and IE8 exit with an error, Firefox does
not respond.

What version of the product are you using? On what browser and what
operating system?
timeplot 1.1; tested with FF, IE and Chrome, Windows Vista

Nov 8, 2010

I found the same problem in chrome. After some research I found the cause:

   In method _prepareCanvas the canvas height is set according to the container's div height minus the paddingY


   According to the HTML5 reference ( the canvas element can't have a negative height. So when this.getHeight() is 0 (because the div is hidden) canvas.height must be 0 not -(this._paddingY*2).

   But chrome allows a negative value for canvas height, so when you reach the function _calculateGrid, you'll be stuck in a loop:

   _calculateGrid : function(){
    //code code
    //this.toScreen(..) will return a negative value
    var dy = this.toScreen(this._minValue + inc);
        // dy is negative and it's value will increase towards a bigger negative value
	while (dy < this._gridSpacing) {
	  inc = new Number(inc).add(unit);
          dy = this.toScreen(this._minValue + inc);
    //code code

   The quickÇ/easy fix is to add an extra check at the beggining of _calculateGrid():

   if (!this._canvas || this._valueRange == 0 || this._canvas.height <= 0) return grid;

Jun 23, 2011
Project Member #2
(No comment was entered for this change.)
Labels: Project-Timeplot
Sign in to add a comment

Powered by Google Project Hosting