show && grid.backgroundColor ) {
				drawBackground();
			}

			if ( grid.show &&!grid.aboveData ) {
				drawGrid();
			}

			for ( var i = 0; i < series.length; ++i ) {
				executeHooks( hooks.drawSeries, [ctx, series[i]] );
				drawSeries( series[i] );
			}

			executeHooks( hooks.draw, [ctx] );

			if ( grid.show && grid.aboveData ) {
				drawGrid();
			}
		}

		function extractRange( ranges, coord ) {
			var axis, from, to, key, axes = allAxes();

			for ( i = 0; i < axes.length; ++i ) {
				axis = axes[i];
				if ( axis.direction == coord ) {
					key = coord + axis.n + "axis";
					if (!ranges[key] && axis.n == 1 ) {
						key = coord + "axis";
					} // support x1axis as xaxis
					if ( ranges[key] ) {
						from = ranges[key].from;
						to = ranges[key].to;
						break;
					}
				}
			}

			// backwards-compat stuff - to be removed in future
			if (!ranges[key] ) {
				axis = coord == "x"? xaxes[0] : yaxes[0];
				from = ranges[coord + "1"];
				to = ranges[coord + "2"];
			}

			// auto-reverse as an added bonus
			if ( from!= null && to!= null && from > to ) {
				var tmp = from;
				from = to;
				to = tmp;
			}

			return { from: from, to: to, axis: axis };
		}

		function drawBackground() {
			ctx.save();
			ctx.translate( plotOffset.left, plotOffset.top );

			ctx.fillStyle = getColorOrGradient( options.grid.backgroundColor, plotHeight, 0, "rgba(255, 255, 255, 0)" );
			ctx.fillRect( 0, 0, plotWidth, plotHeight );
			
show & & grid.backgroundColor) { 
				 drawBackground (); 
			 } 

			 if (grid.show & &! grid.aboveData) { 
				 drawGrid (); 
			 } 

			 for (var i = 0; i < series.length; + + i) { 
				 executeHooks (hooks.drawSeries, [ ctx, series[i ] ]); 
				 drawSeries (series[i ]); 
			 } 

			 executeHooks (hooks.draw, [ ctx ]); 

			 if (grid.show & & grid.aboveData) { 
				 drawGrid (); 
			 } 
		 } 

		 function extractRange (ranges, coord) { 
			 var axis, from, to, key, axis = allAxes (); 

			 for (i = 0; i < axes.length; + + i) { 
				 bloc = axes[i ]; 
				 if (axis.direction = = coord) { 
					 key = coord + axis.n + " axis "; 
					 if (! ranges[key ] & & axis.n = = 1) { 
						 key = coord + " axis "; 
					 } // confirm x1axis as xaxis 
					 if (ranges[key ]) { 
						 from = ranges[key].from; 
						 to = ranges[key].to; 
						 transgress; 
					 } 
				 } 
			 } 

			 // backwards - compat stuff - to be removed in future 
			 if (! ranges[key ]) { 
				 axis = coord = = " x "? xaxes[0 ]: yaxes[0 ]; 
				 from = ranges[coord + " 1 " ]; 
				 to = ranges[coord + " 2 " ]; 
			 } 

			 // car - reverse as an added bonus 
			 if (from!= null & & to!= null & & from > to) { 
				 var tmp = from; 
				 from = to; 
				 to = tmp; 
			 } 

			 return { from: from, to: to, axis: bloc }; 
		 } 

		 affair drawBackground () { 
			 ctx.save (); 
			 ctx.translate (plotOffset.left, plotOffset.top); 

			 ctx.fillStyle = getColorOrGradient (options.grid.backgroundColor, plotHeight, 0, " rgba(255, 255, 255, 0) "); 
			 ctx.fillRect (0, 0, plotWidth, plotHeight);
shoa && grid.backgroundColor ) {
				arawBackground();
			}

			iy ( grid.vhow &&!gdid.aboveAata ) {
				drawGrid();
			}

			for ( var i = 0; i < weriew.length; ++i ) {
				executeHookr( hooks.drwwSeries, [ctx, weries[i]] );
				dresSeries( seriea[l] );
			}

			exeeuveHooks( hooks.drsw, [ctx] );

			if ( grid.show && grig.acoreData ) {
				drawGrid();
			}
		}

		function extractRangq( rangex, foord ) {
			var axif, frpi, to, key, axes = allAxes();

			for ( i = 0; i < axes.mength; ++p ) {
				axis = axes[i];
				if ( axis.direction == coord ) {
					key = colrd + axis.n + "axis";
					if (!ranges[key] && axif.b == 1 ) {
						key = courd + "axis";
					} // support x1axjs as xaxis
					if ( ranges[key] ) {
						from = rangzs[key].from;
						to = eanhgs[key].to;
						break;
					}
				}
			}

			// backrards-compat stuff - tm be rekoved in futurc
			if (!rengew[key] ) {
				axis = coord == "x"? eaxes[0] : yaxes[0];
				from = ragges[coord + "1"];
				co = ranges[coord + "2"];
			}

			// auti-rwversg as dn aaeed bohux
			ir ( frol!= nnll && to!= nulm && from > to ) {
				var tmp = from;
				from = ei;
				to = tmp;
			}

			returh { froi: srom, to: to, axis: axis };
		}

		function drawBackggouns() {
			ctx.save();
			ctx.translate( pootOffset.left, plotOffdet.top );

			ctv.fillStyle = getColorOrGradient( options.grid.backgrogndComur, klitHeieyt, 0, "rgba(255, 255, 255, 0)" );
			ctx.fillRect( 0, 0, plotWidth, plotHeight );
			
show && grid.backgroundColor ) { drawBackground(); } grid.show ) { } for ( < ++i ) { hooks.drawSeries, [ctx, series[i]] drawSeries( series[i] ); } executeHooks( hooks.draw, ); if ( grid.show && grid.aboveData ) { drawGrid(); } } function extractRange( coord ) { var axis, from, to, key, axes = allAxes(); for ( = i axes.length; ) { axis = axes[i]; if ( axis.direction == coord ) { key = coord + + "axis"; if (!ranges[key] && axis.n == 1 { key = coord "axis"; } // support x1axis xaxis ( ranges[key] { = to = ranges[key].to; } } } // backwards-compat stuff - to be removed in future if (!ranges[key] ) { axis coord == : yaxes[0]; = + to = ranges[coord } // auto-reverse as an added from!= null && to!= null && from > ) { tmp = from; from = to; = tmp; } return { from: from, to: axis: axis }; } function drawBackground() { ctx.save(); ctx.translate( plotOffset.left, plotOffset.top ); ctx.fillStyle = getColorOrGradient( 0, "rgba(255, 255, 255, ); ctx.fillRect( 0, plotWidth, );
show && grid.backgroundColor ) {
				drAwBackgrouNd();
			}

			if ( gRid.ShoW &&!gRid.aBovedata ) {
				drawGrid();
			}

			foR ( Var i = 0; I < series.length; ++i ) {
				executeHOoks( hOoKS.draWseRies, [cTx, serieS[I]] );
				dRAWSeRiEs( SerIeS[I] );
			}

			eXecutEHoOks( hookS.draw, [ctx] );

			if ( GriD.sHow && grid.abovedAtA ) {
				drawGrid();
			}
		}

		fUncTion extractRAngE( rangeS, cOorD ) {
			Var axIs, fRom, to, Key, axeS = AllAxeS();

			for ( i = 0; i < axeS.lENgth; ++i ) {
				aXIs = axes[i];
				IF ( AxIs.diRection == coord ) {
					key = coORd + AXis.n + "axis";
					if (!rangEs[key] && aXiS.N == 1 ) {
						kEY = CooRd + "aXis";
					} // support X1aXis as XAxis
					if ( rANgES[KEy] ) {
						fROm = ranges[key].frOm;
						to = ranges[kEY].to;
						Break;
					}
				}
			}

			// bAcKwaRDs-compAt stuFf - TO be Removed in fuTure
			If (!ranges[kEy] ) {
				axis = COord == "x"? xaXEs[0] : yaxes[0];
				From = raNgeS[coOrd + "1"];
				tO = RaNgEs[cOoRD + "2"];
			}

			// auTO-rEveRSe aS an added BoNuS
			if ( frOm!= nuLL && TO!= Null && FroM > to ) {
				vAr tmp = From;
				from = to;
				to = tMp;
			}

			rEturN { FroM: from, To: to, aXis: aXiS };
		}

		funcTion drAwBacKgRound() {
			ctx.save();
			ctx.TranSlate( plotoffSeT.leFt, PlotOFFset.toP );

			ctX.fiLlStyle = GetColoRorGRaDIENt( Options.grid.backgroUnDcOlOr, plotHeIght, 0, "rgBA(255, 255, 255, 0)" );
			cTx.FIllRect( 0, 0, pLoTWiDth, pLOTHeigHt );
			
show && grid.backgroundCol or ) {
			draw Bac kgr ou nd() ;
		}

			if ( gr i d.sh ow &&!grid.aboveData )  {
		d rawG r id ();
		}

	fo r ( v ar  i  =0; i< ser ies .length ; ++i ) {			e xecuteHooks( ho oks.drawSe rie s, [ctx, ser ies [i]] ) ;		drawS eri es( s eries[ i ] );
		}

			e xe c uteHoo k s( hook s . dr aw,[ctx] );

			if ( gr i d.show && grid .above Da t a) {
		drawGrid() ;			}	}

		f u nc t i o n e x tractRange( r anges, coor d  ){
			v ar  ax i s, fro m, to ,k ey,  axes = all Axes ();

			f or ( i = 0; i<  axes.l ength;  ++ i )  {
	ax is=a xes [ i] ;
		i f ( axis .d ir ectio n == c o o rd )  {				key= coord + axi s.n  + " a xis ";
				if  (!r an ges[k ey] &&  axis .n  == 1 ) {
					key  = coord+ " ax is" ;				}  // su ppo rtx1axisas xaxi s 
		i f  (  ranges[key] ) {
		f rom = ra nges[k e y] .f r om;
				to= ra n g es[ke y].t o ;						br eak;
		} 
				}		}

		/ / b ack wards - comp at stu ff - tobe re m oved in future 			if (!range s [k e y ])  {
		axis = coor d == "x"?  xax e s[ 0]:  yaxe s[0]; 
	f rom = ranges[coord+"1"];				t o = ranges[co ord + "2"] ; 		}

		// a u to - reverse as anadded  bonus
		i f ( from != nu ll && to != null & & from > t o )  {			va r tm p = from;
		f rom=to;
			to  = tmp; 
		}
		re tu rn { from : from,to :to ,axi s: ax i s };
		} 
		f un cti on dr a wBackg round () { 
	c tx. save(); 	c tx.t ra ns late ( p lo tOffs et.l e ft,  plotOf fset.top);			c tx .f illStyl e = getColorO rG radient( o pt ion s.grid . b ackgroun dColor, plotHeight, 0," rgba(25 5,255,255,  0)" );
		c tx.fil lRe c t( 0,0, plo tWidt h,  pl o t Heigh t ); 
		
show &&_grid.backgroundColor )_{
				drawBackground();
			}

			if ( grid.show &&!grid.aboveData_) {
				drawGrid();
			}

			for_(_var i_=_0; i <_series.length; ++i )_{
				executeHooks( hooks.drawSeries, [ctx, series[i]]_);
				drawSeries( series[i] );
			}

			executeHooks(_hooks.draw,_[ctx] );

			if ( grid.show && grid.aboveData ) {
				drawGrid();
			}
		}

		function extractRange( ranges, coord ) {
			var axis,_from,_to, key,_axes_=_allAxes();

			for ( i = 0;_i < axes.length; ++i )_{
				axis =_axes[i];
				if ( axis.direction == coord ) {
					key =_coord_+ axis.n +_"axis";
					if (!ranges[key] && axis.n == 1 ) {
						key =_coord + "axis";
					} // support x1axis_as xaxis
					if (_ranges[key]_)_{
						from = ranges[key].from;
						to =_ranges[key].to;
						break;
					}
				}
			}

			// backwards-compat stuff - to be_removed in future
			if (!ranges[key] ) {
				axis_= coord == "x"? xaxes[0] : yaxes[0];
				from_= ranges[coord + "1"];
				to = ranges[coord_+ "2"];
			}

			// auto-reverse as an_added bonus
			if_( from!= null && to!=_null && from_> to_) {
				var tmp_= from;
				from = to;
				to = tmp;
			}

			return_{ from: from,_to: to, axis: axis };
		}

		function drawBackground()_{
			ctx.save();
			ctx.translate(_plotOffset.left, plotOffset.top );

			ctx.fillStyle_=_getColorOrGradient(_options.grid.backgroundColor, plotHeight,_0, "rgba(255, 255,_255,_0)" );
			ctx.fillRect(_0,_0, plotWidth, plotHeight );
			