function drawGrid( me, face, horizontal, vertical, idx, tickPosn, pp ) { var ii = 0, uu = 0; var grid = _GetGrid( me.Min[horizontal] / me.Parent.Zoom[horizontal], me.Max[horizontal] / me.Parent.Zoom[horizontal], me.Scale[horizontal] ); if( me.GridDelta[horizontal] != 0 ) grid.step = me.GridDelta[horizontal]; for( var jj = grid.max; jj >= grid.min; jj -= grid.step ) { pp[horizontal] = jj * me.Parent.Zoom[horizontal]; pp[vertical] = me.Min[vertical]; var vv = me.Parent.ScreenPos( pp ); fromOV( me.Line[idx][ii], vv.x, vv.y ); // Move to the start(min) of this gridline var xx = vv.x, yy = vv.y; // copy of start x/y for later pp[vertical] = me.Max[vertical]; vv = me.Parent.ScreenPos( pp ); // pp changed; get again toOV( me.Line[idx][ii], vv.x, vv.y ); // And draw to the other(max) end me.Line[idx][ii].setAttribute( "stroke", me.StrokeColor ); // Set the color me.Line[idx][ii].setAttribute( "visibility", "visible" ); // and make visible if( tickPosn ) { // Move the tick labels to the appropriate end of the gridlines; 1.06 standoff of label; uu (fudge factor for zooming (not used)) me.Text[idx][ii].setAttribute( "x", Math.floor( xx + ( vv.x - xx ) * 1.06 ) - 50 * uu ); me.Text[idx][ii].setAttribute( "y", Math.floor( yy + ( vv.y - yy ) * 1.06 ) - 7 * uu ); } else { me.Text[idx][ii].setAttribute( "x", Math.floor( vv.x + ( xx - vv.x ) * 1.06 ) - 50 * uu ); me.Text[idx][ii].setAttribute( "y", Math.floor( vv.y + ( yy - vv.y ) * 1.06 ) - 7 * uu ); } me.Text[idx][ii].setAttribute( "fill", me.StrokeColor ); me.Text[idx][ii].setAttribute( "visibility", "visible" ); if( ( ii == 1 ) && ( me.Label[horizontal] ) ) // if 1st (not zeroth?) gridline, add the axis label innerTextOV( me.Text[idx][ii], me.Label[horizontal] ); else { // otherwise add the tick value if( isNaN( me.Scale[horizontal] ) ) { if( me.Scale[horizontal].substr( 0,9 ) == "function " ) { ff = eval( "window." + me.Scale[horizontal].substr( 9 ) ); if( ff ) innerTextOV( me.Text[idx][ii], ff( _ScaleString( jj, grid.step ) ) ); } else innerTextOV( me.Text[idx][ii], _ScaleString( jj, grid.step ) + me.Scale[horizontal] ); } else { if( me.Scale[horizontal] < 1 ) innerTextOV( me.Text[idx][ii], "" ); if( me.Scale[horizontal] == 1 ) innerTextOV( me.Text[idx][ii], _ScaleString( jj, grid.step ) ); if( me.Scale[horizontal] > 1 ) innerTextOV( me.Text[idx][ii], _DateFormat( jj, grid.step, me.Scale[horizontal] ) ); } } ii++; } }