Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(497)

Side by Side Diff: third_party/flot/jquery.flot.fillbetween.min.js

Issue 22357004: Roll the Flot JavaScript plotting library to 0.8.1. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 (function(b){var a={series:{fillBetween:null}};function c(f){function d(j,h){var g;for(g=0;g<h.length;++g){if(h[g].id==j.fillBetween){return h[g]}}if(typeof j.f illBetween=="number"){g=j.fillBetween;if(g<0||g>=h.length){return null}return h[ g]}return null}function e(B,u,g){if(u.fillBetween==null){return}var p=d(u,B.getD ata());if(!p){return}var y=g.pointsize,E=g.points,h=p.datapoints.pointsize,x=p.d atapoints.points,r=[],w,v,k,G,F,q,t=u.lines.show,o=y>2&&g.format[2].y,n=t&&u.lin es.steps,D=true,C=0,A=0,z;while(true){if(C>=E.length){break}z=r.length;if(E[C]== null){for(m=0;m<y;++m){r.push(E[C+m])}C+=y}else{if(A>=x.length){if(!t){for(m=0;m <y;++m){r.push(E[C+m])}}C+=y}else{if(x[A]==null){for(m=0;m<y;++m){r.push(null)}D =true;A+=h}else{w=E[C];v=E[C+1];G=x[A];F=x[A+1];q=0;if(w==G){for(m=0;m<y;++m){r. push(E[C+m])}q=F;C+=y;A+=h}else{if(w>G){if(t&&C>0&&E[C-y]!=null){k=v+(E[C-y+1]-v )*(G-w)/(E[C-y]-w);r.push(G);r.push(k);for(m=2;m<y;++m){r.push(E[C+m])}q=F}A+=h} else{if(D&&t){C+=y;continue}for(m=0;m<y;++m){r.push(E[C+m])}if(t&&A>0&&x[A-h]!=n ull){q=F+(x[A-h+1]-F)*(w-G)/(x[A-h]-G)}C+=y}}D=false;if(z!=r.length&&o){r[z+2]=q }}}}if(n&&z!=r.length&&z>0&&r[z]!=null&&r[z]!=r[z-y]&&r[z+1]!=r[z-y+1]){for(m=0; m<y;++m){r[z+y+m]=r[z+m]}r[z+1]=r[z-y+1]}}g.points=r}f.hooks.processDatapoints.p ush(e)}b.plot.plugins.push({init:c,options:a,name:"fillbetween",version:"1.0"})} )(jQuery); 1 /* Flot plugin for computing bottoms for filled line and bar charts.
2
3 Copyright (c) 2007-2013 IOLA and Ole Laursen.
4 Licensed under the MIT license.
5
6 The case: you've got two series that you want to fill the area between. In Flot
7 terms, you need to use one as the fill bottom of the other. You can specify the
8 bottom of each data point as the third coordinate manually, or you can use this
9 plugin to compute it for you.
10
11 In order to name the other series, you need to give it an id, like this:
12
13 » var dataset = [
14 » » { data: [ ... ], id: "foo" } , // use default bottom
15 » » { data: [ ... ], fillBetween: "foo" }, // use first dataset as b ottom
16 » ];
17
18 » $.plot($("#placeholder"), dataset, { lines: { show: true, fill: true }}) ;
19
20 As a convenience, if the id given is a number that doesn't appear as an id in
21 the series, it is interpreted as the index in the array instead (so fillBetween:
22 0 can also mean the first series).
23
24 Internally, the plugin modifies the datapoints in each series. For line series,
25 extra data points might be inserted through interpolation. Note that at points
26 where the bottom line is not defined (due to a null point or start/end of line),
27 the current line will show a gap too. The algorithm comes from the
28 jquery.flot.stack.js plugin, possibly some code could be shared.
29
30 */(function(e){function n(e){function t(e,t){var n;for(n=0;n<t.length;++n)if(t[n ].id===e.fillBetween)return t[n];return typeof e.fillBetween=="number"?e.fillBet ween<0||e.fillBetween>=t.length?null:t[e.fillBetween]:null}function n(e,n,r){if( n.fillBetween==null)return;var i=t(n,e.getData());if(!i)return;var s=r.pointsize ,o=r.points,u=i.datapoints.pointsize,a=i.datapoints.points,f=[],l,c,h,p,d,v,m=n. lines.show,g=s>2&&r.format[2].y,y=m&&n.lines.steps,b=!0,w=0,E=0,S,x;for(;;){if(w >=o.length)break;S=f.length;if(o[w]==null){for(x=0;x<s;++x)f.push(o[w+x]);w+=s}e lse if(E>=a.length){if(!m)for(x=0;x<s;++x)f.push(o[w+x]);w+=s}else if(a[E]==null ){for(x=0;x<s;++x)f.push(null);b=!0,E+=u}else{l=o[w],c=o[w+1],p=a[E],d=a[E+1],v= 0;if(l===p){for(x=0;x<s;++x)f.push(o[w+x]);v=d,w+=s,E+=u}else if(l>p){if(m&&w>0& &o[w-s]!=null){h=c+(o[w-s+1]-c)*(p-l)/(o[w-s]-l),f.push(p),f.push(h);for(x=2;x<s ;++x)f.push(o[w+x]);v=d}E+=u}else{if(b&&m){w+=s;continue}for(x=0;x<s;++x)f.push( o[w+x]);m&&E>0&&a[E-u]!=null&&(v=d+(a[E-u+1]-d)*(l-p)/(a[E-u]-p)),w+=s}b=!1,S!== f.length&&g&&(f[S+2]=v)}if(y&&S!==f.length&&S>0&&f[S]!==null&&f[S]!==f[S-s]&&f[S +1]!==f[S-s+1]){for(x=0;x<s;++x)f[S+s+x]=f[S+x];f[S+1]=f[S-s+1]}}r.points=f}e.ho oks.processDatapoints.push(n)}var t={series:{fillBetween:null}};e.plot.plugins.p ush({init:n,options:t,name:"fillbetween",version:"1.0"})})(jQuery);
OLDNEW
« no previous file with comments | « third_party/flot/jquery.flot.errorbars.min.js ('k') | third_party/flot/jquery.flot.image.min.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698