Seditio Source
Root |
./othercms/b2evolution_7.2.3/rsc/ext/jquery/jqplot/js/jqplot.barRenderer.min.js
!function(i){function t(t,e,s,h){if("horizontal"==this.rendererOptions.barDirection&&(this._stackAxis="x",this._primaryAxis="_yaxis"),1==this.rendererOptions.waterfall){this._data=i.extend(!0,[],this.data);for(var r=0,a=this.rendererOptions.barDirection&&"vertical"!==this.rendererOptions.barDirection&&this.transposedData!==!1?0:1,l=0;l<this.data.length;l++)r+=this.data[l][a],l>0&&(this.data[l][a]+=this.data[l-1][a]);this.data[this.data.length]=1==a?[this.data.length+1,r]:[r,this.data.length+1],this._data[this._data.length]=1==a?[this._data.length+1,r]:[r,this._data.length+1]}if(this.rendererOptions.groups>1){this.breakOnNull=!0;for(var n=this.data.length,o=parseInt(n/this.rendererOptions.groups,10),d=0,l=o;l<n;l+=o)this.data.splice(l+d,0,[null,null]),this._plotData.splice(l+d,0,[null,null]),this._stackData.splice(l+d,0,[null,null]),d++;for(l=0;l<this.data.length;l++)"_xaxis"==this._primaryAxis?(this.data[l][0]=l+1,this._plotData[l][0]=l+1,this._stackData[l][0]=l+1):(this.data[l][1]=l+1,this._plotData[l][1]=l+1,this._stackData[l][1]=l+1)}}function e(i,t,s,h,r){var a,l,n=i,o=i-1,d="x"===r?0:1;return n>0?(l=h.series[o]._plotData[t][d],a=s*l<0?e(o,t,s,h,r):h.series[o].gridData[t][d]):a=0===d?h.series[n]._xaxis.series_u2p(0):h.series[n]._yaxis.series_u2p(0),a}function s(t,e,s){for(var h=0;h<this.series.length;h++)this.series[h].renderer.constructor==i.jqplot.BarRenderer&&this.series[h].highlightMouseOver&&(this.series[h].highlightMouseDown=!1)}function h(){this.plugins.barRenderer&&this.plugins.barRenderer.highlightCanvas&&(this.plugins.barRenderer.highlightCanvas.resetCanvas(),this.plugins.barRenderer.highlightCanvas=null),this.plugins.barRenderer={highlightedSeriesIndex:null},this.plugins.barRenderer.highlightCanvas=new i.jqplot.GenericCanvas,this.eventCanvas._elem.before(this.plugins.barRenderer.highlightCanvas.createElement(this._gridPadding,"jqplot-barRenderer-highlight-canvas",this._plotDimensions,this)),this.plugins.barRenderer.highlightCanvas.setContext(),this.eventCanvas._elem.bind("mouseleave",{plot:this},function(i){a(i.data.plot)})}function r(i,t,e,s){var h=i.series[t],r=i.plugins.barRenderer.highlightCanvas;r._ctx.clearRect(0,0,r._ctx.canvas.width,r._ctx.canvas.height),h._highlightedPoint=e,i.plugins.barRenderer.highlightedSeriesIndex=t;var a={fillStyle:h.highlightColors[e]};h.renderer.shapeRenderer.draw(r._ctx,s,a),r=null}function a(i){var t=i.plugins.barRenderer.highlightCanvas;t._ctx.clearRect(0,0,t._ctx.canvas.width,t._ctx.canvas.height);for(var e=0;e<i.series.length;e++)i.series[e]._highlightedPoint=null;i.plugins.barRenderer.highlightedSeriesIndex=null,i.target.trigger("jqplotDataUnhighlight"),t=null}function l(i,t,e,s,h){if(s){var l=[s.seriesIndex,s.pointIndex,s.data],n=jQuery.Event("jqplotDataMouseOver");if(n.pageX=i.pageX,n.pageY=i.pageY,h.target.trigger(n,l),h.series[l[0]].show&&h.series[l[0]].highlightMouseOver&&(l[0]!=h.plugins.barRenderer.highlightedSeriesIndex||l[1]!=h.series[l[0]]._highlightedPoint)){var o=jQuery.Event("jqplotDataHighlight");o.which=i.which,o.pageX=i.pageX,o.pageY=i.pageY,h.target.trigger(o,l),r(h,s.seriesIndex,s.pointIndex,s.points)}}else null==s&&a(h)}function n(i,t,e,s,h){if(s){var l=[s.seriesIndex,s.pointIndex,s.data];if(h.series[l[0]].highlightMouseDown&&(l[0]!=h.plugins.barRenderer.highlightedSeriesIndex||l[1]!=h.series[l[0]]._highlightedPoint)){var n=jQuery.Event("jqplotDataHighlight");n.which=i.which,n.pageX=i.pageX,n.pageY=i.pageY,h.target.trigger(n,l),r(h,s.seriesIndex,s.pointIndex,s.points)}}else null==s&&a(h)}function o(i,t,e,s,h){var r=h.plugins.barRenderer.highlightedSeriesIndex;null!=r&&h.series[r].highlightMouseDown&&a(h)}function d(i,t,e,s,h){if(s){var r=[s.seriesIndex,s.pointIndex,s.data],a=jQuery.Event("jqplotDataClick");a.which=i.which,a.pageX=i.pageX,a.pageY=i.pageY,h.target.trigger(a,r)}}function g(i,t,e,s,h){if(s){var r=[s.seriesIndex,s.pointIndex,s.data],l=h.plugins.barRenderer.highlightedSeriesIndex;null!=l&&h.series[l].highlightMouseDown&&a(h);var n=jQuery.Event("jqplotDataRightClick");n.which=i.which,n.pageX=i.pageX,n.pageY=i.pageY,h.target.trigger(n,r)}}i.jqplot.BarRenderer=function(){i.jqplot.LineRenderer.call(this)},i.jqplot.BarRenderer.prototype=new i.jqplot.LineRenderer,i.jqplot.BarRenderer.prototype.constructor=i.jqplot.BarRenderer,i.jqplot.BarRenderer.prototype.init=function(t,e){this.barPadding=8,this.barMargin=10,this.barDirection="vertical",this.barWidth=null,this.shadowOffset=2,this.shadowDepth=5,this.shadowAlpha=.08,this.waterfall=!1,this.groups=1,this.varyBarColor=!1,this.highlightMouseOver=!0,this.highlightMouseDown=!1,this.highlightColors=[],this.transposedData=!0,this.renderer.animation={show:!1,direction:"down",speed:3e3,_supported:!0},this._type="bar",t.highlightMouseDown&&null==t.highlightMouseOver&&(t.highlightMouseOver=!1),i.extend(!0,this,t),i.extend(!0,this.renderer,t),this.fill=!0,"horizontal"===this.barDirection&&this.rendererOptions.animation&&null==this.rendererOptions.animation.direction&&(this.renderer.animation.direction="left"),this.waterfall&&(this.fillToZero=!1,this.disableStack=!0),"vertical"==this.barDirection?(this._primaryAxis="_xaxis",this._stackAxis="y",this.fillAxis="y"):(this._primaryAxis="_yaxis",this._stackAxis="x",this.fillAxis="x"),this._highlightedPoint=null,this._plotSeriesInfo=null,this._dataColors=[],this._barPoints=[];var r={lineJoin:"miter",lineCap:"round",fill:!0,isarc:!1,strokeStyle:this.color,fillStyle:this.color,closePath:this.fill};this.renderer.shapeRenderer.init(r);var a={lineJoin:"miter",lineCap:"round",fill:!0,isarc:!1,angle:this.shadowAngle,offset:this.shadowOffset,alpha:this.shadowAlpha,depth:this.shadowDepth,closePath:this.fill};this.renderer.shadowRenderer.init(a),e.postInitHooks.addOnce(s),e.postDrawHooks.addOnce(h),e.eventListenerHooks.addOnce("jqplotMouseMove",l),e.eventListenerHooks.addOnce("jqplotMouseDown",n),e.eventListenerHooks.addOnce("jqplotMouseUp",o),e.eventListenerHooks.addOnce("jqplotClick",d),e.eventListenerHooks.addOnce("jqplotRightClick",g)},i.jqplot.preSeriesInitHooks.push(t),i.jqplot.BarRenderer.prototype.calcSeriesNumbers=function(){for(var t,e,s=0,h=0,r=this[this._primaryAxis],a=0;a<r._series.length;a++)t=r._series[a],t===this&&(e=a),t.renderer.constructor==i.jqplot.BarRenderer&&(s+=t.data.length,h+=1);return[s,h,e]},i.jqplot.BarRenderer.prototype.setBarWidth=function(){var i=0,t=0,e=this[this._primaryAxis],s=this._plotSeriesInfo=this.renderer.calcSeriesNumbers.call(this);i=s[0],t=s[1];var h=e.numberTicks,r=(h-1)/2;return"xaxis"==e.name||"x2axis"==e.name?this._stack?this.barWidth=(e._offsets.max-e._offsets.min)/i*t-this.barMargin:this.barWidth=((e._offsets.max-e._offsets.min)/r-this.barPadding*(t-1)-2*this.barMargin)/t:this._stack?this.barWidth=(e._offsets.min-e._offsets.max)/i*t-this.barMargin:this.barWidth=((e._offsets.min-e._offsets.max)/r-this.barPadding*(t-1)-2*this.barMargin)/t,[i,t]},i.jqplot.BarRenderer.prototype.draw=function(t,s,h,r){var a,l=i.extend({},h),n=void 0!=l.shadow?l.shadow:this.shadow,o=void 0!=l.showLine?l.showLine:this.showLine;void 0!=l.fill?l.fill:this.fill,this.xaxis,this.yaxis,this._xaxis.series_u2p,this._yaxis.series_u2p;this._dataColors=[],this._barPoints=[],null!=this.barWidth&&null!=this.rendererOptions.barWidth||this.renderer.setBarWidth.call(this);var d=this._plotSeriesInfo=this.renderer.calcSeriesNumbers.call(this),g=(d[0],d[1]),p=d[2],u=[];if(this._stack?this._barNudge=0:this._barNudge=(-Math.abs(g/2-.5)+p)*(this.barWidth+this.barPadding),o){var _=new i.jqplot.ColorGenerator(this.negativeSeriesColors),c=new i.jqplot.ColorGenerator(this.seriesColors),f=_.get(this.index);this.useNegativeColors||(f=l.fillStyle);var x,v,b,w=l.fillStyle;if("vertical"==this.barDirection){for(var a=0;a<s.length;a++)if(this._stack||null!=this.data[a][1]){if(u=[],x=s[a][0]+this._barNudge,b=this._stack&&this._prevGridData.length?e(this.index,a,this._plotData[a][1],r,"y"):this.fillToZero?this._yaxis.series_u2p(0):this.waterfall&&a>0&&a<this.gridData.length-1?this.gridData[a-1][1]:this.waterfall&&0==a&&a<this.gridData.length-1?this._yaxis.min<=0&&this._yaxis.max>=0?this._yaxis.series_u2p(0):this._yaxis.min>0?t.canvas.height:0:this.waterfall&&a==this.gridData.length-1?this._yaxis.min<=0&&this._yaxis.max>=0?this._yaxis.series_u2p(0):this._yaxis.min>0?t.canvas.height:0:t.canvas.height,this.fillToZero&&this._plotData[a][1]<0||this.waterfall&&this._data[a][1]<0?this.varyBarColor&&!this._stack?this.useNegativeColors?l.fillStyle=_.next():l.fillStyle=c.next():l.fillStyle=f:this.varyBarColor&&!this._stack?l.fillStyle=c.next():l.fillStyle=w,!this.fillToZero||this._plotData[a][1]>=0?(u.push([x-this.barWidth/2,b]),u.push([x-this.barWidth/2,s[a][1]]),u.push([x+this.barWidth/2,s[a][1]]),u.push([x+this.barWidth/2,b])):(u.push([x-this.barWidth/2,s[a][1]]),u.push([x-this.barWidth/2,b]),u.push([x+this.barWidth/2,b]),u.push([x+this.barWidth/2,s[a][1]])),this._barPoints.push(u),n&&!this._stack){var y=i.extend(!0,{},l);delete y.fillStyle,this.renderer.shadowRenderer.draw(t,u,y)}var D=l.fillStyle||this.color;this._dataColors.push(D),this.renderer.shapeRenderer.draw(t,u,l)}}else if("horizontal"==this.barDirection)for(var a=0;a<s.length;a++)if(this._stack||null!=this.data[a][0]){if(u=[],x=s[a][1]-this._barNudge,v=this._stack&&this._prevGridData.length?e(this.index,a,this._plotData[a][0],r,"x"):this.fillToZero?this._xaxis.series_u2p(0):this.waterfall&&a>0&&a<this.gridData.length-1?this.gridData[a-1][0]:this.waterfall&&0==a&&a<this.gridData.length-1?this._xaxis.min<=0&&this._xaxis.max>=0?this._xaxis.series_u2p(0):(this._xaxis.min>0,0):this.waterfall&&a==this.gridData.length-1?this._xaxis.min<=0&&this._xaxis.max>=0?this._xaxis.series_u2p(0):this._xaxis.min>0?0:t.canvas.width:0,this.fillToZero&&this._plotData[a][0]<0||this.waterfall&&this._data[a][0]<0?this.varyBarColor&&!this._stack?this.useNegativeColors?l.fillStyle=_.next():l.fillStyle=c.next():l.fillStyle=f:this.varyBarColor&&!this._stack?l.fillStyle=c.next():l.fillStyle=w,!this.fillToZero||this._plotData[a][0]>=0?(u.push([v,x+this.barWidth/2]),u.push([v,x-this.barWidth/2]),u.push([s[a][0],x-this.barWidth/2]),u.push([s[a][0],x+this.barWidth/2])):(u.push([s[a][0],x+this.barWidth/2]),u.push([s[a][0],x-this.barWidth/2]),u.push([v,x-this.barWidth/2]),u.push([v,x+this.barWidth/2])),this._barPoints.push(u),n&&!this._stack){var y=i.extend(!0,{},l);delete y.fillStyle,this.renderer.shadowRenderer.draw(t,u,y)}var D=l.fillStyle||this.color;this._dataColors.push(D),this.renderer.shapeRenderer.draw(t,u,l)}}if(0==this.highlightColors.length)this.highlightColors=i.jqplot.computeHighlightColors(this._dataColors);else if("string"==typeof this.highlightColors){var d=this.highlightColors;this.highlightColors=[];for(var a=0;a<this._dataColors.length;a++)this.highlightColors.push(d)}},i.jqplot.BarRenderer.prototype.drawShadow=function(i,t,s,h){var r,a,l,n,o,d=void 0!=s?s:{},g=(void 0!=d.shadow?d.shadow:this.shadow,void 0!=d.showLine?d.showLine:this.showLine);void 0!=d.fill?d.fill:this.fill,this.xaxis,this.yaxis,this._xaxis.series_u2p,this._yaxis.series_u2p;if(this._stack&&this.shadow){null==this.barWidth&&this.renderer.setBarWidth.call(this);var p=this._plotSeriesInfo=this.renderer.calcSeriesNumbers.call(this);if(l=p[0],n=p[1],o=p[2],this._stack?this._barNudge=0:this._barNudge=(-Math.abs(n/2-.5)+o)*(this.barWidth+this.barPadding),g)if("vertical"==this.barDirection){for(var r=0;r<t.length;r++)if(null!=this.data[r][1]){a=[];var u,_=t[r][0]+this._barNudge;u=this._stack&&this._prevGridData.length?e(this.index,r,this._plotData[r][1],h,"y"):this.fillToZero?this._yaxis.series_u2p(0):i.canvas.height,a.push([_-this.barWidth/2,u]),a.push([_-this.barWidth/2,t[r][1]]),a.push([_+this.barWidth/2,t[r][1]]),a.push([_+this.barWidth/2,u]),this.renderer.shadowRenderer.draw(i,a,d)}}else if("horizontal"==this.barDirection)for(var r=0;r<t.length;r++)if(null!=this.data[r][0]){a=[];var c,_=t[r][1]-this._barNudge;c=this._stack&&this._prevGridData.length?e(this.index,r,this._plotData[r][0],h,"x"):this.fillToZero?this._xaxis.series_u2p(0):0,a.push([c,_+this.barWidth/2]),a.push([t[r][0],_+this.barWidth/2]),a.push([t[r][0],_-this.barWidth/2]),a.push([c,_-this.barWidth/2]),this.renderer.shadowRenderer.draw(i,a,d)}}}}(jQuery);