Seditio Source
Root |
./othercms/b2evolution_7.2.3/rsc/ext/jquery/jqplot/js/jqplot.donutRenderer.min.js
!function(e){function t(t,i,s){s=s||{},s.axesDefaults=s.axesDefaults||{},s.legend=s.legend||{},s.seriesDefaults=s.seriesDefaults||{};var r=!1;if(s.seriesDefaults.renderer==e.jqplot.DonutRenderer)r=!0;else if(s.series)for(var n=0;n<s.series.length;n++)s.series[n].renderer==e.jqplot.DonutRenderer&&(r=!0);r&&(s.axesDefaults.renderer=e.jqplot.DonutAxisRenderer,s.legend.renderer=e.jqplot.DonutLegendRenderer,s.legend.preDraw=!0,s.seriesDefaults.pointLabels={show:!1})}function i(t,i,s){for(var r=1;r<this.series.length;r++)if(!this.series[r]._previousSeries.length)for(var n=0;n<r;n++)this.series[r].renderer.constructor==e.jqplot.DonutRenderer&&this.series[n].renderer.constructor==e.jqplot.DonutRenderer&&this.series[r]._previousSeries.push(this.series[n]);for(r=0;r<this.series.length;r++)this.series[r].renderer.constructor==e.jqplot.DonutRenderer&&(this.series[r]._numberSeries=this.series.length,this.series[r].highlightMouseOver&&(this.series[r].highlightMouseDown=!1))}function s(t){for(var i=0;i<this.series.length;i++)this.series[i].seriesColors=this.seriesColors,this.series[i].colorGenerator=e.jqplot.colorGenerator}function r(e,t,i){var s=e.series[t],r=e.plugins.donutRenderer.highlightCanvas;r._ctx.clearRect(0,0,r._ctx.canvas.width,r._ctx.canvas.height),s._highlightedPoint=i,e.plugins.donutRenderer.highlightedSeriesIndex=t,s.renderer.drawSlice.call(s,r._ctx,s._sliceAngles[i][0],s._sliceAngles[i][1],s.highlightColors[i],!1)}function n(e){var t=e.plugins.donutRenderer.highlightCanvas;t._ctx.clearRect(0,0,t._ctx.canvas.width,t._ctx.canvas.height);for(var i=0;i<e.series.length;i++)e.series[i]._highlightedPoint=null;e.plugins.donutRenderer.highlightedSeriesIndex=null,e.target.trigger("jqplotDataUnhighlight")}function h(e,t,i,s,h){if(s){var a=[s.seriesIndex,s.pointIndex,s.data],o=jQuery.Event("jqplotDataMouseOver");if(o.pageX=e.pageX,o.pageY=e.pageY,h.target.trigger(o,a),h.series[a[0]].highlightMouseOver&&(a[0]!=h.plugins.donutRenderer.highlightedSeriesIndex||a[1]!=h.series[a[0]]._highlightedPoint)){var l=jQuery.Event("jqplotDataHighlight");l.which=e.which,l.pageX=e.pageX,l.pageY=e.pageY,h.target.trigger(l,a),r(h,a[0],a[1])}}else null==s&&n(h)}function a(e,t,i,s,h){if(s){var a=[s.seriesIndex,s.pointIndex,s.data];if(h.series[a[0]].highlightMouseDown&&(a[0]!=h.plugins.donutRenderer.highlightedSeriesIndex||a[1]!=h.series[a[0]]._highlightedPoint)){var o=jQuery.Event("jqplotDataHighlight");o.which=e.which,o.pageX=e.pageX,o.pageY=e.pageY,h.target.trigger(o,a),r(h,a[0],a[1])}}else null==s&&n(h)}function o(e,t,i,s,r){var h=r.plugins.donutRenderer.highlightedSeriesIndex;null!=h&&r.series[h].highlightMouseDown&&n(r)}function l(e,t,i,s,r){if(s){var n=[s.seriesIndex,s.pointIndex,s.data],h=jQuery.Event("jqplotDataClick");h.which=e.which,h.pageX=e.pageX,h.pageY=e.pageY,r.target.trigger(h,n)}}function d(e,t,i,s,r){if(s){var h=[s.seriesIndex,s.pointIndex,s.data],a=r.plugins.donutRenderer.highlightedSeriesIndex;null!=a&&r.series[a].highlightMouseDown&&n(r);var o=jQuery.Event("jqplotDataRightClick");o.which=e.which,o.pageX=e.pageX,o.pageY=e.pageY,r.target.trigger(o,h)}}function g(){this.plugins.donutRenderer&&this.plugins.donutRenderer.highlightCanvas&&(this.plugins.donutRenderer.highlightCanvas.resetCanvas(),this.plugins.donutRenderer.highlightCanvas=null),this.plugins.donutRenderer={highlightedSeriesIndex:null},this.plugins.donutRenderer.highlightCanvas=new e.jqplot.GenericCanvas;var t=e(this.targetId+" .jqplot-data-label");t.length?e(t[0]).before(this.plugins.donutRenderer.highlightCanvas.createElement(this._gridPadding,"jqplot-donutRenderer-highlight-canvas",this._plotDimensions,this)):this.eventCanvas._elem.before(this.plugins.donutRenderer.highlightCanvas.createElement(this._gridPadding,"jqplot-donutRenderer-highlight-canvas",this._plotDimensions,this));this.plugins.donutRenderer.highlightCanvas.setContext();this.eventCanvas._elem.bind("mouseleave",{plot:this},function(e){n(e.data.plot)})}e.jqplot.DonutRenderer=function(){e.jqplot.LineRenderer.call(this)},e.jqplot.DonutRenderer.prototype=new e.jqplot.LineRenderer,e.jqplot.DonutRenderer.prototype.constructor=e.jqplot.DonutRenderer,e.jqplot.DonutRenderer.prototype.init=function(t,r){if(this.diameter=null,this.innerDiameter=null,this.thickness=null,this.padding=20,this.sliceMargin=0,this.ringMargin=null,this.fill=!0,this.shadowOffset=2,this.shadowAlpha=.07,this.shadowDepth=5,this.highlightMouseOver=!0,this.highlightMouseDown=!1,this.highlightColors=[],this.dataLabels="percent",this.showDataLabels=!1,this.totalLabel=!1,this.dataLabelFormatString=null,this.dataLabelThreshold=3,this.dataLabelPositionFactor=.4,this.dataLabelNudge=0,this.startAngle=0,this.tickRenderer=e.jqplot.DonutTickRenderer,this._drawData=!0,this._type="donut",t.highlightMouseDown&&null==t.highlightMouseOver&&(t.highlightMouseOver=!1),e.extend(!0,this,t),null!=this.diameter&&(this.diameter=this.diameter-this.sliceMargin),this._diameter=null,this._innerDiameter=null,this._radius=null,this._innerRadius=null,this._thickness=null,this._previousSeries=[],this._numberSeries=1,this._sliceAngles=[],this._highlightedPoint=null,0==this.highlightColors.length)for(var n=0;n<this.seriesColors.length;n++){for(var p=e.jqplot.getColorComponents(this.seriesColors[n]),u=[p[0],p[1],p[2]],c=u[0]+u[1]+u[2],f=0;f<3;f++)u[f]=c>570?.8*u[f]:u[f]+.3*(255-u[f]),u[f]=parseInt(u[f],10);this.highlightColors.push("rgb("+u[0]+","+u[1]+","+u[2]+")")}r.postParseOptionsHooks.addOnce(s),r.postInitHooks.addOnce(i),r.eventListenerHooks.addOnce("jqplotMouseMove",h),r.eventListenerHooks.addOnce("jqplotMouseDown",a),r.eventListenerHooks.addOnce("jqplotMouseUp",o),r.eventListenerHooks.addOnce("jqplotClick",l),r.eventListenerHooks.addOnce("jqplotRightClick",d),r.postDrawHooks.addOnce(g)},e.jqplot.DonutRenderer.prototype.setGridData=function(e){var t=[],i=[],s=(this.startAngle/180*Math.PI,0);this._drawData=!1;for(var r=0;r<this.data.length;r++)0!=this.data[r][1]&&(this._drawData=!0),t.push(this.data[r][1]),i.push([this.data[r][0]]),r>0&&(t[r]+=t[r-1]),s+=this.data[r][1];for(var n=2*Math.PI/t[t.length-1],r=0;r<t.length;r++)i[r][1]=t[r]*n,i[r][2]=this.data[r][1]/s;this.gridData=i},e.jqplot.DonutRenderer.prototype.makeGridData=function(e,t){var i=[],s=[],r=0;this.startAngle/180*Math.PI;this._drawData=!1;for(var n=0;n<e.length;n++)0!=this.data[n][1]&&(this._drawData=!0),i.push(e[n][1]),s.push([e[n][0]]),n>0&&(i[n]+=i[n-1]),r+=e[n][1];for(var h=2*Math.PI/i[i.length-1],n=0;n<i.length;n++)s[n][1]=i[n]*h,s[n][2]=e[n][1]/r;return this._totalAmount=r,s},e.jqplot.DonutRenderer.prototype.drawSlice=function(e,t,i,s,r){function n(){i>6.282+this.startAngle&&(i=6.282+this.startAngle,t>i&&(t=6.281+this.startAngle)),t>=i||(e.beginPath(),e.fillStyle=s,e.strokeStyle=s,e.arc(0,0,h,t,i,!1),e.lineTo(a*Math.cos(i),a*Math.sin(i)),e.arc(0,0,a,i,t,!0),e.closePath(),o?e.fill():e.stroke())}var h=this._diameter/2,a=h-this._thickness,o=this.fill;if(e.save(),e.translate(this._center[0],this._center[1]),r)for(var l=0;l<this.shadowDepth;l++)e.save(),e.translate(this.shadowOffset*Math.cos(this.shadowAngle/180*Math.PI),this.shadowOffset*Math.sin(this.shadowAngle/180*Math.PI)),n();else n();if(r)for(var l=0;l<this.shadowDepth;l++)e.restore();e.restore()},e.jqplot.DonutRenderer.prototype.draw=function(t,i,s,r){var n,h=void 0!=s?s:{},a=0,o=0,l=1;if(s.legendInfo&&"insideGrid"==s.legendInfo.placement){var d=s.legendInfo;switch(d.location){case"nw":a=d.width+d.xoffset;break;case"w":a=d.width+d.xoffset;break;case"sw":a=d.width+d.xoffset;break;case"ne":a=d.width+d.xoffset,l=-1;break;case"e":a=d.width+d.xoffset,l=-1;break;case"se":a=d.width+d.xoffset,l=-1;break;case"n":o=d.height+d.yoffset;break;case"s":o=d.height+d.yoffset,l=-1}}for(var g=(void 0!=h.shadow?h.shadow:this.shadow,void 0!=h.showLine?h.showLine:this.showLine,void 0!=h.fill?h.fill:this.fill,parseInt(t.canvas.style.width)),p=parseInt(t.canvas.style.height),u=g-a-2*this.padding,c=p-o-2*this.padding,f=Math.min(u,c),v=f,m=null==this.ringMargin?2*this.sliceMargin:this.ringMargin,n=0;n<this._previousSeries.length;n++)v-=2*this._previousSeries[n]._thickness+2*m;if(this._diameter=this.diameter||v,null!=this.innerDiameter){var j=this._numberSeries>1&&this.index>0?this._previousSeries[0]._diameter:this._diameter;this._thickness=this.thickness||(j-this.innerDiameter-2*m*this._numberSeries)/this._numberSeries/2}else this._thickness=this.thickness||f/2/(this._numberSeries+1)*.85;if(this._diameter<6)return void e.jqplot.log("Diameter of donut too small, not rendering.");this._radius=this._diameter/2;this._innerRadius=this._radius-this._thickness;var _=this.startAngle/180*Math.PI;if(this._center=[(g-l*a)/2+l*a,(p-l*o)/2+l*o],this.shadow)for(var w="rgba(0,0,0,"+this.shadowAlpha+")",n=0;n<i.length;n++){var b=0==n?_:i[n-1][1]+_;b+=this.sliceMargin/180*Math.PI,this.renderer.drawSlice.call(this,t,b,i[n][1]+_,w,!0)}for(var n=0;n<i.length;n++){var b=0==n?_:i[n-1][1]+_;b+=this.sliceMargin/180*Math.PI;var D=i[n][1]+_;if(this._sliceAngles.push([b,D]),this.renderer.drawSlice.call(this,t,b,D,this.seriesColors[n],!1),this.showDataLabels&&100*i[n][2]>=this.dataLabelThreshold){var q,R,x=(b+D)/2;"label"==this.dataLabels?(q=this.dataLabelFormatString||"%s",R=e.jqplot.sprintf(q,i[n][0])):"value"==this.dataLabels?(q=this.dataLabelFormatString||"%d",R=e.jqplot.sprintf(q,this.data[n][1])):"percent"==this.dataLabels?(q=this.dataLabelFormatString||"%d%%",R=e.jqplot.sprintf(q,100*i[n][2])):this.dataLabels.constructor==Array&&(q=this.dataLabelFormatString||"%s",R=e.jqplot.sprintf(q,this.dataLabels[n]));var k=this._innerRadius+this._thickness*this.dataLabelPositionFactor+this.sliceMargin+this.dataLabelNudge,M=this._center[0]+Math.cos(x)*k+this.canvas._offsets.left,L=this._center[1]+Math.sin(x)*k+this.canvas._offsets.top,C=e('<span class="jqplot-donut-series jqplot-data-label" style="position:absolute;">'+R+"</span>").insertBefore(r.eventCanvas._elem);M-=C.width()/2,L-=C.height()/2,M=Math.round(M),L=Math.round(L),C.css({left:M,top:L})}}if(this.totalLabel){var y=e('<div class="jqplot-data-label" style="position:absolute">'+this._totalAmount+"</div>").insertAfter(r.eventCanvas._elem);y.css({left:this._center[0],top:this._center[1]})}},e.jqplot.DonutAxisRenderer=function(){e.jqplot.LinearAxisRenderer.call(this)},e.jqplot.DonutAxisRenderer.prototype=new e.jqplot.LinearAxisRenderer,e.jqplot.DonutAxisRenderer.prototype.constructor=e.jqplot.DonutAxisRenderer,e.jqplot.DonutAxisRenderer.prototype.init=function(t){this.tickRenderer=e.jqplot.DonutTickRenderer,e.extend(!0,this,t),this._dataBounds={min:0,max:100},this.min=0,this.max=100,this.showTicks=!1,this.ticks=[],this.showMark=!1,this.show=!1},e.jqplot.DonutLegendRenderer=function(){e.jqplot.TableLegendRenderer.call(this)},e.jqplot.DonutLegendRenderer.prototype=new e.jqplot.TableLegendRenderer,e.jqplot.DonutLegendRenderer.prototype.constructor=e.jqplot.DonutLegendRenderer,e.jqplot.DonutLegendRenderer.prototype.init=function(t){this.numberRows=null,this.numberColumns=null,e.extend(!0,this,t)},e.jqplot.DonutLegendRenderer.prototype.draw=function(){if(this.show){var t=this._series,i="position:absolute;";i+=this.background?"background:"+this.background+";":"",i+=this.border?"border:"+this.border+";":"",i+=this.fontSize?"font-size:"+this.fontSize+";":"",i+=this.fontFamily?"font-family:"+this.fontFamily+";":"",i+=this.textColor?"color:"+this.textColor+";":"",i+=null!=this.marginTop?"margin-top:"+this.marginTop+";":"",i+=null!=this.marginBottom?"margin-bottom:"+this.marginBottom+";":"",i+=null!=this.marginLeft?"margin-left:"+this.marginLeft+";":"",i+=null!=this.marginRight?"margin-right:"+this.marginRight+";":"",this._elem=e('<table class="jqplot-table-legend" style="'+i+'"></table>');var s,r,n=!1,h=!1,a=t[0],o=new e.jqplot.ColorGenerator(a.seriesColors);if(a.show){var l=a.data;this.numberRows?(s=this.numberRows,r=this.numberColumns?this.numberColumns:Math.ceil(l.length/s)):this.numberColumns?(r=this.numberColumns,s=Math.ceil(l.length/this.numberColumns)):(s=l.length,r=1);var d,g,p,u,c,f,v,m,j=0;for(d=0;d<s;d++)for(p=h?e('<tr class="jqplot-table-legend"></tr>').prependTo(this._elem):e('<tr class="jqplot-table-legend"></tr>').appendTo(this._elem),g=0;g<r;g++)j<l.length&&(f=this.labels[j]||l[j][0].toString(),m=o.next(),n=h?d!=s-1:d>0,v=n?this.rowSpacing:"0",u=e('<td class="jqplot-table-legend" style="text-align:center;padding-top:'+v+';"><div><div class="jqplot-table-legend-swatch" style="border-color:'+m+';"></div></div></td>'),c=e('<td class="jqplot-table-legend" style="padding-top:'+v+';"></td>'),this.escapeHtml?c.text(f):c.html(f),h?(c.prependTo(p),u.prependTo(p)):(u.appendTo(p),c.appendTo(p)),n=!0),j++}}return this._elem};e.jqplot.preInitHooks.push(t),e.jqplot.DonutTickRenderer=function(){e.jqplot.AxisTickRenderer.call(this)},e.jqplot.DonutTickRenderer.prototype=new e.jqplot.AxisTickRenderer,e.jqplot.DonutTickRenderer.prototype.constructor=e.jqplot.DonutTickRenderer}(jQuery);