2017-08-10 15:32:24 +00:00
|
|
|
!function(s){var n={series:{stack:null}};jQuery.plot.plugins.push({init:function(s){function n(s,n){for(var t=null,i=0;i<n.length&&s!=n[i];++i)n[i].stack==s.stack&&(t=n[i]);return t}s.hooks.processDatapoints.push(function(s,t,i){if(null!=t.stack&&!1!==t.stack){var l=n(t,s.getData());if(l){for(var o,e,u,f,a,p,r,h,c=i.pointsize,g=i.points,k=l.datapoints.pointsize,v=l.datapoints.points,m=[],z=t.lines.show,d=t.bars.horizontal,y=c>2&&(d?i.format[2].x:i.format[2].y),D=z&&t.lines.steps,b=!0,j=d?1:0,w=d?0:1,x=0,Q=0;!(x>=g.length);){if(r=m.length,null==g[x]){for(h=0;h<c;++h)m.push(g[x+h]);x+=c}else if(Q>=v.length){if(!z)for(h=0;h<c;++h)m.push(g[x+h]);x+=c}else if(null==v[Q]){for(h=0;h<c;++h)m.push(null);b=!0,Q+=k}else{if(o=g[x+j],e=g[x+w],f=v[Q+j],a=v[Q+w],p=0,o==f){for(h=0;h<c;++h)m.push(g[x+h]);m[r+w]+=a,p=a,x+=c,Q+=k}else if(o>f){if(z&&x>0&&null!=g[x-c]){for(u=e+(g[x-c+w]-e)*(f-o)/(g[x-c+j]-o),m.push(f),m.push(u+a),h=2;h<c;++h)m.push(g[x+h]);p=a}Q+=k}else{if(b&&z){x+=c;continue}for(h=0;h<c;++h)m.push(g[x+h]);z&&Q>0&&null!=v[Q-k]&&(p=a+(v[Q-k+w]-a)*(o-f)/(v[Q-k+j]-f)),m[r+w]+=p,x+=c}b=!1,r!=m.length&&y&&(m[r+2]+=p)}if(D&&r!=m.length&&r>0&&null!=m[r]&&m[r]!=m[r-c]&&m[r+1]!=m[r-c+1]){for(h=0;h<c;++h)m[r+c+h]=m[r+h];m[r+1]=m[r-c+1]}}i.points=m}}})},options:n,name:"stack",version:"1.2"})}();
|