| 7 (function($){var options={series:{fillBetween:null}};function init(plot){functio
n findBottomSeries(s,allseries){var i;for(i=0;i<allseries.length;++i){if(allseri
es[i].id===s.fillBetween){return allseries[i]}}if(typeof s.fillBetween==="number
"){if(s.fillBetween<0||s.fillBetween>=allseries.length){return null}return allse
ries[s.fillBetween]}return null}function computeFillBottoms(plot,s,datapoints){i
f(s.fillBetween==null){return}var other=findBottomSeries(s,plot.getData());if(!o
ther){return}var ps=datapoints.pointsize,points=datapoints.points,otherps=other.
datapoints.pointsize,otherpoints=other.datapoints.points,newpoints=[],px,py,inte
ry,qx,qy,bottom,withlines=s.lines.show,withbottom=ps>2&&datapoints.format[2].y,w
ithsteps=withlines&&s.lines.steps,fromgap=true,i=0,j=0,l,m;while(true){if(i>=poi
nts.length){break}l=newpoints.length;if(points[i]==null){for(m=0;m<ps;++m){newpo
ints.push(points[i+m])}i+=ps}else if(j>=otherpoints.length){if(!withlines){for(m
=0;m<ps;++m){newpoints.push(points[i+m])}}i+=ps}else if(otherpoints[j]==null){fo
r(m=0;m<ps;++m){newpoints.push(null)}fromgap=true;j+=otherps}else{px=points[i];p
y=points[i+1];qx=otherpoints[j];qy=otherpoints[j+1];bottom=0;if(px===qx){for(m=0
;m<ps;++m){newpoints.push(points[i+m])}bottom=qy;i+=ps;j+=otherps}else if(px>qx)
{if(withlines&&i>0&&points[i-ps]!=null){intery=py+(points[i-ps+1]-py)*(qx-px)/(p
oints[i-ps]-px);newpoints.push(qx);newpoints.push(intery);for(m=2;m<ps;++m){newp
oints.push(points[i+m])}bottom=qy}j+=otherps}else{if(fromgap&&withlines){i+=ps;c
ontinue}for(m=0;m<ps;++m){newpoints.push(points[i+m])}if(withlines&&j>0&&otherpo
ints[j-otherps]!=null){bottom=qy+(otherpoints[j-otherps+1]-qy)*(px-qx)/(otherpoi
nts[j-otherps]-qx)}i+=ps}fromgap=false;if(l!==newpoints.length&&withbottom){newp
oints[l+2]=bottom}}if(withsteps&&l!==newpoints.length&&l>0&&newpoints[l]!==null&
&newpoints[l]!==newpoints[l-ps]&&newpoints[l+1]!==newpoints[l-ps+1]){for(m=0;m<p
s;++m){newpoints[l+ps+m]=newpoints[l+m]}newpoints[l+1]=newpoints[l-ps+1]}}datapo
ints.points=newpoints}plot.hooks.processDatapoints.push(computeFillBottoms)}$.pl
ot.plugins.push({init:init,options:options,name:"fillbetween",version:"1.0"})})(
jQuery); |