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

Side by Side Diff: third_party/flot/jquery.flot.pie.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){function c(D){var h=null;var L=null;var n=null;var B=null;var p=nul l;var M=0;var F=true;var o=10;var w=0.95;var A=0;var d=false;var z=false;var j=[ ];D.hooks.processOptions.push(g);D.hooks.bindEvents.push(e);function g(O,N){if(N .series.pie.show){N.grid.show=false;if(N.series.pie.label.show=="auto"){if(N.leg end.show){N.series.pie.label.show=false}else{N.series.pie.label.show=true}}if(N. series.pie.radius=="auto"){if(N.series.pie.label.show){N.series.pie.radius=3/4}e lse{N.series.pie.radius=1}}if(N.series.pie.tilt>1){N.series.pie.tilt=1}if(N.seri es.pie.tilt<0){N.series.pie.tilt=0}O.hooks.processDatapoints.push(E);O.hooks.dra wOverlay.push(H);O.hooks.draw.push(r)}}function e(P,N){var O=P.getOptions();if(O .series.pie.show&&O.grid.hoverable){N.unbind("mousemove").mousemove(t)}if(O.seri es.pie.show&&O.grid.clickable){N.unbind("click").click(l)}}function G(O){var P=" ";function N(S,T){if(!T){T=0}for(var R=0;R<S.length;++R){for(var Q=0;Q<T;Q++){P+ ="\t"}if(typeof S[R]=="object"){P+=""+R+":\n";N(S[R],T+1)}else{P+=""+R+": "+S[R] +"\n"}}}N(O);alert(P)}function q(P){for(var N=0;N<P.length;++N){var O=parseFloat (P[N].data[0][1]);if(O){M+=O}}}function E(Q,N,O,P){if(!d){d=true;h=Q.getCanvas() ;L=b(h).parent();a=Q.getOptions();Q.setData(K(Q.getData()))}}function I(){A=L.ch ildren().filter(".legend").children().width();n=Math.min(h.width,(h.height/a.ser ies.pie.tilt))/2;p=(h.height/2)+a.series.pie.offset.top;B=(h.width/2);if(a.serie s.pie.offset.left=="auto"){if(a.legend.position.match("w")){B+=A/2}else{B-=A/2}} else{B+=a.series.pie.offset.left}if(B<n){B=n}else{if(B>h.width-n){B=h.width-n}}} function v(O){for(var N=0;N<O.length;++N){if(typeof(O[N].data)=="number"){O[N].d ata=[[1,O[N].data]]}else{if(typeof(O[N].data)=="undefined"||typeof(O[N].data[0]) =="undefined"){if(typeof(O[N].data)!="undefined"&&typeof(O[N].data.label)!="unde fined"){O[N].label=O[N].data.label}O[N].data=[[1,0]]}}}return O}function K(Q){Q= v(Q);q(Q);var P=0;var S=0;var N=a.series.pie.combine.color;var R=[];for(var O=0; O<Q.length;++O){Q[O].data[0][1]=parseFloat(Q[O].data[0][1]);if(!Q[O].data[0][1]) {Q[O].data[0][1]=0}if(Q[O].data[0][1]/M<=a.series.pie.combine.threshold){P+=Q[O] .data[0][1];S++;if(!N){N=Q[O].color}}else{R.push({data:[[1,Q[O].data[0][1]]],col or:Q[O].color,label:Q[O].label,angle:(Q[O].data[0][1]*(Math.PI*2))/M,percent:(Q[ O].data[0][1]/M*100)})}}if(S>0){R.push({data:[[1,P]],color:N,label:a.series.pie. combine.label,angle:(P*(Math.PI*2))/M,percent:(P/M*100)})}return R}function r(S, Q){if(!L){return}ctx=Q;I();var T=S.getData();var P=0;while(F&&P<o){F=false;if(P> 0){n*=w}P+=1;N();if(a.series.pie.tilt<=0.8){O()}R()}if(P>=o){N();L.prepend('<div class="error">Could not draw pie with labels contained inside canvas</div>')}if (S.setSeries&&S.insertLegend){S.setSeries(T);S.insertLegend()}function N(){ctx.c learRect(0,0,h.width,h.height);L.children().filter(".pieLabel, .pieLabelBackgrou nd").remove()}function O(){var Z=5;var Y=15;var W=10;var X=0.02;if(a.series.pie. radius>1){var U=a.series.pie.radius}else{var U=n*a.series.pie.radius}if(U>=(h.wi dth/2)-Z||U*a.series.pie.tilt>=(h.height/2)-Y||U<=W){return}ctx.save();ctx.trans late(Z,Y);ctx.globalAlpha=X;ctx.fillStyle="#000";ctx.translate(B,p);ctx.scale(1, a.series.pie.tilt);for(var V=1;V<=W;V++){ctx.beginPath();ctx.arc(0,0,U,0,Math.PI *2,false);ctx.fill();U-=V}ctx.restore()}function R(){startAngle=Math.PI*a.series .pie.startAngle;if(a.series.pie.radius>1){var U=a.series.pie.radius}else{var U=n *a.series.pie.radius}ctx.save();ctx.translate(B,p);ctx.scale(1,a.series.pie.tilt );ctx.save();var Y=startAngle;for(var W=0;W<T.length;++W){T[W].startAngle=Y;X(T[ W].angle,T[W].color,true)}ctx.restore();ctx.save();ctx.lineWidth=a.series.pie.st roke.width;Y=startAngle;for(var W=0;W<T.length;++W){X(T[W].angle,a.series.pie.st roke.color,false)}ctx.restore();J(ctx);if(a.series.pie.label.show){V()}ctx.resto re();function X(ab,Z,aa){if(ab<=0){return}if(aa){ctx.fillStyle=Z}else{ctx.stroke Style=Z;ctx.lineJoin="round"}ctx.beginPath();if(Math.abs(ab-Math.PI*2)>1e-9){ctx .moveTo(0,0)}else{if(b.browser.msie){ab-=0.0001}}ctx.arc(0,0,U,Y,Y+ab,false);ctx .closePath();Y+=ab;if(aa){ctx.fill()}else{ctx.stroke()}}function V(){var ac=star tAngle;if(a.series.pie.label.radius>1){var Z=a.series.pie.label.radius}else{var Z=n*a.series.pie.label.radius}for(var ab=0;ab<T.length;++ab){if(T[ab].percent>=a .series.pie.label.threshold*100){aa(T[ab],ac,ab)}ac+=T[ab].angle}function aa(ap, ai,ag){if(ap.data[0][1]==0){return}var ar=a.legend.labelFormatter,aq,ae=a.series .pie.label.formatter;if(ar){aq=ar(ap.label,ap)}else{aq=ap.label}if(ae){aq=ae(aq, ap)}var aj=((ai+ap.angle)+ai)/2;var ao=B+Math.round(Math.cos(aj)*Z);var am=p+Mat h.round(Math.sin(aj)*Z)*a.series.pie.tilt;var af='<span class="pieLabel" id="pie Label'+ag+'" style="position:absolute;top:'+am+"px;left:"+ao+'px;">'+aq+"</span> ";L.append(af);var an=L.children("#pieLabel"+ag);var ad=(am-an.height()/2);var a h=(ao-an.width()/2);an.css("top",ad);an.css("left",ah);if(0-ad>0||0-ah>0||h.heig ht-(ad+an.height())<0||h.width-(ah+an.width())<0){F=true}if(a.series.pie.label.b ackground.opacity!=0){var ak=a.series.pie.label.background.color;if(ak==null){ak =ap.color}var al="top:"+ad+"px;left:"+ah+"px;";b('<div class="pieLabelBackground " style="position:absolute;width:'+an.width()+"px;height:"+an.height()+"px;"+al+ "background-color:"+ak+';"> </div>').insertBefore(an).css("opacity",a.series.pie .label.background.opacity)}}}}}function J(N){if(a.series.pie.innerRadius>0){N.sa ve();innerRadius=a.series.pie.innerRadius>1?a.series.pie.innerRadius:n*a.series. pie.innerRadius;N.globalCompositeOperation="destination-out";N.beginPath();N.fil lStyle=a.series.pie.stroke.color;N.arc(0,0,innerRadius,0,Math.PI*2,false);N.fill ();N.closePath();N.restore();N.save();N.beginPath();N.strokeStyle=a.series.pie.s troke.color;N.arc(0,0,innerRadius,0,Math.PI*2,false);N.stroke();N.closePath();N. restore()}}function s(Q,R){for(var S=false,P=-1,N=Q.length,O=N-1;++P<N;O=P){((Q[ P][1]<=R[1]&&R[1]<Q[O][1])||(Q[O][1]<=R[1]&&R[1]<Q[P][1]))&&(R[0]<(Q[O][0]-Q[P][ 0])*(R[1]-Q[P][1])/(Q[O][1]-Q[P][1])+Q[P][0])&&(S=!S)}return S}function u(R,P){v ar T=D.getData(),O=D.getOptions(),N=O.series.pie.radius>1?O.series.pie.radius:n* O.series.pie.radius;for(var Q=0;Q<T.length;++Q){var S=T[Q];if(S.pie.show){ctx.sa ve();ctx.beginPath();ctx.moveTo(0,0);ctx.arc(0,0,N,S.startAngle,S.startAngle+S.a ngle,false);ctx.closePath();x=R-B;y=P-p;if(ctx.isPointInPath){if(ctx.isPointInPa th(R-B,P-p)){ctx.restore();return{datapoint:[S.percent,S.data],dataIndex:0,serie s:S,seriesIndex:Q}}}else{p1X=(N*Math.cos(S.startAngle));p1Y=(N*Math.sin(S.startA ngle));p2X=(N*Math.cos(S.startAngle+(S.angle/4)));p2Y=(N*Math.sin(S.startAngle+( S.angle/4)));p3X=(N*Math.cos(S.startAngle+(S.angle/2)));p3Y=(N*Math.sin(S.startA ngle+(S.angle/2)));p4X=(N*Math.cos(S.startAngle+(S.angle/1.5)));p4Y=(N*Math.sin( S.startAngle+(S.angle/1.5)));p5X=(N*Math.cos(S.startAngle+S.angle));p5Y=(N*Math. sin(S.startAngle+S.angle));arrPoly=[[0,0],[p1X,p1Y],[p2X,p2Y],[p3X,p3Y],[p4X,p4Y ],[p5X,p5Y]];arrPoint=[x,y];if(s(arrPoly,arrPoint)){ctx.restore();return{datapoi nt:[S.percent,S.data],dataIndex:0,series:S,seriesIndex:Q}}}ctx.restore()}}return null}function t(N){m("plothover",N)}function l(N){m("plotclick",N)}function m(N ,T){var O=D.offset(),R=parseInt(T.pageX-O.left),P=parseInt(T.pageY-O.top),V=u(R, P);if(a.grid.autoHighlight){for(var Q=0;Q<j.length;++Q){var S=j[Q];if(S.auto==N& &!(V&&S.series==V.series)){f(S.series)}}}if(V){k(V.series,N)}var U={pageX:T.page X,pageY:T.pageY};L.trigger(N,[U,V])}function k(O,P){if(typeof O=="number"){O=ser ies[O]}var N=C(O);if(N==-1){j.push({series:O,auto:P});D.triggerRedrawOverlay()}e lse{if(!P){j[N].auto=false}}}function f(O){if(O==null){j=[];D.triggerRedrawOverl ay()}if(typeof O=="number"){O=series[O]}var N=C(O);if(N!=-1){j.splice(N,1);D.tri ggerRedrawOverlay()}}function C(P){for(var N=0;N<j.length;++N){var O=j[N];if(O.s eries==P){return N}}return -1}function H(Q,R){var P=Q.getOptions();var N=P.serie s.pie.radius>1?P.series.pie.radius:n*P.series.pie.radius;R.save();R.translate(B, p);R.scale(1,P.series.pie.tilt);for(i=0;i<j.length;++i){O(j[i].series)}J(R);R.re store();function O(S){if(S.angle<0){return}R.fillStyle="rgba(255, 255, 255, "+P. series.pie.highlight.opacity+")";R.beginPath();if(Math.abs(S.angle-Math.PI*2)>1e -9){R.moveTo(0,0)}R.arc(0,0,N,S.startAngle,S.startAngle+S.angle,false);R.closePa th();R.fill()}}}var a={series:{pie:{show:false,radius:"auto",innerRadius:0,start Angle:3/2,tilt:1,offset:{top:0,left:"auto"},stroke:{color:"#FFF",width:1},label: {show:"auto",formatter:function(d,e){return'<div style="font-size:x-small;text-a lign:center;padding:2px;color:'+e.color+';">'+d+"<br/>"+Math.round(e.percent)+"% </div>"},radius:1,background:{color:null,opacity:0},threshold:0},combine:{thresh old:-1,color:null,label:"Other"},highlight:{opacity:0.5}}}};b.plot.plugins.push( {init:c,options:a,name:"pie",version:"1.0"})})(jQuery); 1 /* Flot plugin for rendering pie charts.
2
3 Copyright (c) 2007-2013 IOLA and Ole Laursen.
4 Licensed under the MIT license.
5
6 The plugin assumes that each series has a single data value, and that each
7 value is a positive integer or zero. Negative numbers don't make sense for a
8 pie chart, and have unpredictable results. The values do NOT need to be
9 passed in as percentages; the plugin will calculate the total and per-slice
10 percentages internally.
11
12 * Created by Brian Medendorp
13
14 * Updated with contributions from btburnett3, Anthony Aragues and Xavi Ivars
15
16 The plugin supports these options:
17
18 series: {
19 pie: {
20 show: true/false
21 radius: 0-1 for percentage of fullsize, or a specified p ixel length, or 'auto'
22 innerRadius: 0-1 for percentage of fullsize or a specifi ed pixel length, for creating a donut effect
23 startAngle: 0-2 factor of PI used for starting angle (in radians) i.e 3/2 starts at the top, 0 and 2 have the same result
24 tilt: 0-1 for percentage to tilt the pie, where 1 is no tilt, and 0 is completely flat (nothing will show)
25 offset: {
26 top: integer value to move the pie up or down
27 left: integer value to move the pie left or righ t, or 'auto'
28 },
29 stroke: {
30 color: any hexidecimal color value (other format s may or may not work, so best to stick with something like '#FFF')
31 width: integer pixel width of the stroke
32 },
33 label: {
34 show: true/false, or 'auto'
35 formatter: a user-defined function that modifie s the text/style of the label text
36 radius: 0-1 for percentage of fullsize, or a spe cified pixel length
37 background: {
38 color: any hexidecimal color value (othe r formats may or may not work, so best to stick with something like '#000')
39 opacity: 0-1
40 },
41 threshold: 0-1 for the percentage value at which to hide labels (if they're too small)
42 },
43 combine: {
44 threshold: 0-1 for the percentage value at which to combine slices (if they're too small)
45 color: any hexidecimal color value (other format s may or may not work, so best to stick with something like '#CCC'), if null, th e plugin will automatically use the color of the first slice to be combined
46 label: any text value of what the combined slice should be labeled
47 }
48 highlight: {
49 opacity: 0-1
50 }
51 }
52 }
53
54 More detail and specific examples can be found in the included HTML file.
55
56 */(function(e){function r(r){function p(t,n,r){l||(l=!0,s=t.getCanvas(),o=e(s).p arent(),i=t.getOptions(),t.setData(d(t.getData())))}function d(t){var n=0,r=0,s= 0,o=i.series.pie.combine.color,u=[];for(var a=0;a<t.length;++a){var f=t[a].data; e.isArray(f)&&f.length==1&&(f=f[0]),e.isArray(f)?!isNaN(parseFloat(f[1]))&&isFin ite(f[1])?f[1]=+f[1]:f[1]=0:!isNaN(parseFloat(f))&&isFinite(f)?f=[1,+f]:f=[1,0], t[a].data=[f]}for(var a=0;a<t.length;++a)n+=t[a].data[0][1];for(var a=0;a<t.leng th;++a){var f=t[a].data[0][1];f/n<=i.series.pie.combine.threshold&&(r+=f,s++,o|| (o=t[a].color))}for(var a=0;a<t.length;++a){var f=t[a].data[0][1];(s<2||f/n>i.se ries.pie.combine.threshold)&&u.push({data:[[1,f]],color:t[a].color,label:t[a].la bel,angle:f*Math.PI*2/n,percent:f/(n/100)})}return s>1&&u.push({data:[[1,r]],col or:o,label:i.series.pie.combine.label,angle:r*Math.PI*2/n,percent:r/(n/100)}),u} function v(r,s){function y(){c.clearRect(0,0,h,p),o.children().filter(".pieLabel , .pieLabelBackground").remove()}function b(){var e=i.series.pie.shadow.left,t=i .series.pie.shadow.top,n=10,r=i.series.pie.shadow.alpha,s=i.series.pie.radius>1? i.series.pie.radius:u*i.series.pie.radius;if(s>=h/2-e||s*i.series.pie.tilt>=p/2- t||s<=n)return;c.save(),c.translate(e,t),c.globalAlpha=r,c.fillStyle="#000",c.tr anslate(a,f),c.scale(1,i.series.pie.tilt);for(var o=1;o<=n;o++)c.beginPath(),c.a rc(0,0,s,0,Math.PI*2,!1),c.fill(),s-=o;c.restore()}function w(){function l(e,t,i ){if(e<=0||isNaN(e))return;i?c.fillStyle=t:(c.strokeStyle=t,c.lineJoin="round"), c.beginPath(),Math.abs(e-Math.PI*2)>1e-9&&c.moveTo(0,0),c.arc(0,0,n,r,r+e/2,!1), c.arc(0,0,n,r+e/2,r+e,!1),c.closePath(),r+=e,i?c.fill():c.stroke()}function d(){ function l(t,n,s){if(t.data[0][1]==0)return!0;var u=i.legend.labelFormatter,l,c= i.series.pie.label.formatter;u?l=u(t.label,t):l=t.label,c&&(l=c(l,t));var d=(n+t .angle+n)/2,v=a+Math.round(Math.cos(d)*r),m=f+Math.round(Math.sin(d)*r)*i.series .pie.tilt,g="<span class='pieLabel' id='pieLabel"+s+"' style='position:absolute; top:"+m+"px;left:"+v+"px;'>"+l+"</span>";o.append(g);var y=o.children("#pieLabel "+s),b=m-y.height()/2,w=v-y.width()/2;y.css("top",b),y.css("left",w);if(0-b>0||0 -w>0||p-(b+y.height())<0||h-(w+y.width())<0)return!1;if(i.series.pie.label.backg round.opacity!=0){var E=i.series.pie.label.background.color;E==null&&(E=t.color) ;var S="top:"+b+"px;left:"+w+"px;";e("<div class='pieLabelBackground' style='pos ition:absolute;width:"+y.width()+"px;height:"+y.height()+"px;"+S+"background-col or:"+E+";'></div>").css("opacity",i.series.pie.label.background.opacity).insertB efore(y)}return!0}var n=t,r=i.series.pie.label.radius>1?i.series.pie.label.radiu s:u*i.series.pie.label.radius;for(var s=0;s<v.length;++s){if(v[s].percent>=i.ser ies.pie.label.threshold*100&&!l(v[s],n,s))return!1;n+=v[s].angle}return!0}var t= Math.PI*i.series.pie.startAngle,n=i.series.pie.radius>1?i.series.pie.radius:u*i. series.pie.radius;c.save(),c.translate(a,f),c.scale(1,i.series.pie.tilt),c.save( );var r=t;for(var s=0;s<v.length;++s)v[s].startAngle=r,l(v[s].angle,v[s].color,! 0);c.restore();if(i.series.pie.stroke.width>0){c.save(),c.lineWidth=i.series.pie .stroke.width,r=t;for(var s=0;s<v.length;++s)l(v[s].angle,i.series.pie.stroke.co lor,!1);c.restore()}return m(c),c.restore(),i.series.pie.label.show?d():!0}if(!o )return;var h=r.getPlaceholder().width(),p=r.getPlaceholder().height(),d=o.child ren().filter(".legend").children().width()||0;c=s,l=!1,u=Math.min(h,p/i.series.p ie.tilt)/2,f=p/2+i.series.pie.offset.top,a=h/2,i.series.pie.offset.left=="auto"? i.legend.position.match("w")?a+=d/2:a-=d/2:a+=i.series.pie.offset.left,a<u?a=u:a >h-u&&(a=h-u);var v=r.getData(),g=0;do g>0&&(u*=n),g+=1,y(),i.series.pie.tilt<=. 8&&b();while(!w()&&g<t);g>=t&&(y(),o.prepend("<div class='error'>Could not draw pie with labels contained inside canvas</div>")),r.setSeries&&r.insertLegend&&(r .setSeries(v),r.insertLegend())}function m(e){if(i.series.pie.innerRadius>0){e.s ave();var t=i.series.pie.innerRadius>1?i.series.pie.innerRadius:u*i.series.pie.i nnerRadius;e.globalCompositeOperation="destination-out",e.beginPath(),e.fillStyl e=i.series.pie.stroke.color,e.arc(0,0,t,0,Math.PI*2,!1),e.fill(),e.closePath(),e .restore(),e.save(),e.beginPath(),e.strokeStyle=i.series.pie.stroke.color,e.arc( 0,0,t,0,Math.PI*2,!1),e.stroke(),e.closePath(),e.restore()}}function g(e,t){for( var n=!1,r=-1,i=e.length,s=i-1;++r<i;s=r)(e[r][1]<=t[1]&&t[1]<e[s][1]||e[s][1]<= t[1]&&t[1]<e[r][1])&&t[0]<(e[s][0]-e[r][0])*(t[1]-e[r][1])/(e[s][1]-e[r][1])+e[r ][0]&&(n=!n);return n}function y(e,t){var n=r.getData(),i=r.getOptions(),s=i.ser ies.pie.radius>1?i.series.pie.radius:u*i.series.pie.radius,o,l;for(var h=0;h<n.l ength;++h){var p=n[h];if(p.pie.show){c.save(),c.beginPath(),c.moveTo(0,0),c.arc( 0,0,s,p.startAngle,p.startAngle+p.angle/2,!1),c.arc(0,0,s,p.startAngle+p.angle/2 ,p.startAngle+p.angle,!1),c.closePath(),o=e-a,l=t-f;if(c.isPointInPath){if(c.isP ointInPath(e-a,t-f))return c.restore(),{datapoint:[p.percent,p.data],dataIndex:0 ,series:p,seriesIndex:h}}else{var d=s*Math.cos(p.startAngle),v=s*Math.sin(p.star tAngle),m=s*Math.cos(p.startAngle+p.angle/4),y=s*Math.sin(p.startAngle+p.angle/4 ),b=s*Math.cos(p.startAngle+p.angle/2),w=s*Math.sin(p.startAngle+p.angle/2),E=s* Math.cos(p.startAngle+p.angle/1.5),S=s*Math.sin(p.startAngle+p.angle/1.5),x=s*Ma th.cos(p.startAngle+p.angle),T=s*Math.sin(p.startAngle+p.angle),N=[[0,0],[d,v],[ m,y],[b,w],[E,S],[x,T]],C=[o,l];if(g(N,C))return c.restore(),{datapoint:[p.perce nt,p.data],dataIndex:0,series:p,seriesIndex:h}}c.restore()}}return null}function b(e){E("plothover",e)}function w(e){E("plotclick",e)}function E(e,t){var n=r.of fset(),s=parseInt(t.pageX-n.left),u=parseInt(t.pageY-n.top),a=y(s,u);if(i.grid.a utoHighlight)for(var f=0;f<h.length;++f){var l=h[f];l.auto==e&&(!a||l.series!=a. series)&&x(l.series)}a&&S(a.series,e);var c={pageX:t.pageX,pageY:t.pageY};o.trig ger(e,[c,a])}function S(e,t){var n=T(e);n==-1?(h.push({series:e,auto:t}),r.trigg erRedrawOverlay()):t||(h[n].auto=!1)}function x(e){e==null&&(h=[],r.triggerRedra wOverlay());var t=T(e);t!=-1&&(h.splice(t,1),r.triggerRedrawOverlay())}function T(e){for(var t=0;t<h.length;++t){var n=h[t];if(n.series==e)return t}return-1}fun ction N(e,t){function s(e){if(e.angle<=0||isNaN(e.angle))return;t.fillStyle="rgb a(255, 255, 255, "+n.series.pie.highlight.opacity+")",t.beginPath(),Math.abs(e.a ngle-Math.PI*2)>1e-9&&t.moveTo(0,0),t.arc(0,0,r,e.startAngle,e.startAngle+e.angl e/2,!1),t.arc(0,0,r,e.startAngle+e.angle/2,e.startAngle+e.angle,!1),t.closePath( ),t.fill()}var n=e.getOptions(),r=n.series.pie.radius>1?n.series.pie.radius:u*n. series.pie.radius;t.save(),t.translate(a,f),t.scale(1,n.series.pie.tilt);for(var i=0;i<h.length;++i)s(h[i].series);m(t),t.restore()}var s=null,o=null,u=null,a=n ull,f=null,l=!1,c=null,h=[];r.hooks.processOptions.push(function(e,t){t.series.p ie.show&&(t.grid.show=!1,t.series.pie.label.show=="auto"&&(t.legend.show?t.serie s.pie.label.show=!1:t.series.pie.label.show=!0),t.series.pie.radius=="auto"&&(t. series.pie.label.show?t.series.pie.radius=.75:t.series.pie.radius=1),t.series.pi e.tilt>1?t.series.pie.tilt=1:t.series.pie.tilt<0&&(t.series.pie.tilt=0))}),r.hoo ks.bindEvents.push(function(e,t){var n=e.getOptions();n.series.pie.show&&(n.grid .hoverable&&t.unbind("mousemove").mousemove(b),n.grid.clickable&&t.unbind("click ").click(w))}),r.hooks.processDatapoints.push(function(e,t,n,r){var i=e.getOptio ns();i.series.pie.show&&p(e,t,n,r)}),r.hooks.drawOverlay.push(function(e,t){var n=e.getOptions();n.series.pie.show&&N(e,t)}),r.hooks.draw.push(function(e,t){var n=e.getOptions();n.series.pie.show&&v(e,t)})}var t=10,n=.95,i={series:{pie:{sho w:!1,radius:"auto",innerRadius:0,startAngle:1.5,tilt:1,shadow:{left:5,top:15,alp ha:.02},offset:{top:0,left:"auto"},stroke:{color:"#fff",width:1},label:{show:"au to",formatter:function(e,t){return"<div style='font-size:x-small;text-align:cent er;padding:2px;color:"+t.color+";'>"+e+"<br/>"+Math.round(t.percent)+"%</div>"}, radius:1,background:{color:null,opacity:0},threshold:0},combine:{threshold:-1,co lor:null,label:"Other"},highlight:{opacity:.5}}}};e.plot.plugins.push({init:r,op tions:i,name:"pie",version:"1.1"})})(jQuery);
OLDNEW
« no previous file with comments | « third_party/flot/jquery.flot.navigate.min.js ('k') | third_party/flot/jquery.flot.resize.min.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698