META-INF.resources.bower_components.jqplot-jwebswing.plugins.jqplot.pieRenderer.min.js Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of jwebmp-jqplot Show documentation
Show all versions of jwebmp-jqplot Show documentation
The JWebSwing implementation for JQPlot Plugin
(function(e){e.jqplot.PieRenderer=function(){e.jqplot.LineRenderer.call(this)};e.jqplot.PieRenderer.prototype=new e.jqplot.LineRenderer();e.jqplot.PieRenderer.prototype.constructor=e.jqplot.PieRenderer;e.jqplot.PieRenderer.prototype.init=function(q,u){this.diameter=null;this.padding=20;this.sliceMargin=0;this.fill=true;this.shadowOffset=2;this.shadowAlpha=0.07;this.shadowDepth=5;this.highlightMouseOver=true;this.highlightMouseDown=false;this.highlightColors=[];this.dataLabels="percent";this.showDataLabels=false;this.dataLabelFormatString=null;this.dataLabelThreshold=3;this.dataLabelPositionFactor=0.52;this.dataLabelNudge=2;this.dataLabelCenterOn=true;this.startAngle=0;this.tickRenderer=e.jqplot.PieTickRenderer;this.showSlice=[];this._drawData=true;this._type="pie";if(q.highlightMouseDown&&q.highlightMouseOver==null){q.highlightMouseOver=false}e.extend(true,this,q);if(this.sliceMargin<0){this.sliceMargin=0}this._diameter=null;this._radius=null;this._sliceAngles=[];this._highlightedPoint=null;if(this.highlightColors.length==0){for(var s=0;s570)?o[p]*0.8:o[p]+0.3*(255-o[p]);o[p]=parseInt(o[p],10)}this.highlightColors.push("rgb("+o[0]+","+o[1]+","+o[2]+")")}}this.highlightColorGenerator=new e.jqplot.ColorGenerator(this.highlightColors);u.postParseOptionsHooks.addOnce(m);u.postInitHooks.addOnce(g);u.eventListenerHooks.addOnce("jqplotMouseMove",b);u.eventListenerHooks.addOnce("jqplotMouseDown",a);u.eventListenerHooks.addOnce("jqplotMouseUp",l);u.eventListenerHooks.addOnce("jqplotClick",f);u.eventListenerHooks.addOnce("jqplotRightClick",n);u.postDrawHooks.addOnce(i)};e.jqplot.PieRenderer.prototype.setGridData=function(t){var p=[];var u=[];var o=this.startAngle/180*Math.PI;var s=0;this._drawData=false;for(var r=0;r0){p[r]+=p[r-1]}s+=this.data[r][1]}var q=Math.PI*2/p[p.length-1];for(var r=0;r0){p[r]+=p[r-1]}s+=t[r][1]}var q=Math.PI*2/p[p.length-1];for(var r=0;r0&&s>0.01&&s<6.282){w=parseFloat(p)/2/h(q)}return w}e.jqplot.PieRenderer.prototype.drawSlice=function(B,z,y,u,w){if(this._drawData){var p=this._radius;var A=this.fill;var x=this.lineWidth;var s=this.sliceMargin;if(this.fill==false){s+=this.lineWidth}B.save();B.translate(this._center[0],this._center[1]);var D=j(z,y,this.sliceMargin,this.fill,this.lineWidth);var o=D*Math.cos((z+y)/2);var C=D*Math.sin((z+y)/2);if((y-z)<=Math.PI){p-=D}else{p+=D}B.translate(o,C);if(w){for(var v=0,t=this.shadowDepth;v6.282+this.startAngle){y=6.282+this.startAngle;if(z>y){z=6.281+this.startAngle}}if(z>=y){return}B.beginPath();B.fillStyle=u;B.strokeStyle=u;B.lineWidth=x;B.arc(0,0,r,z,y,false);B.lineTo(0,0);B.closePath();if(A){B.fill()}else{B.stroke()}}};e.jqplot.PieRenderer.prototype.draw=function(B,z,E,o){var X;var H=(E!=undefined)?E:{};var t=0;var s=0;var N=1;var L=new e.jqplot.ColorGenerator(this.seriesColors);var T;if(E.legendInfo&&E.legendInfo.placement=="insideGrid"){var J=E.legendInfo;switch(J.location){case"nw":t=J.width+J.xoffset;break;case"w":t=J.width+J.xoffset;break;case"sw":t=J.width+J.xoffset;break;case"ne":t=J.width+J.xoffset;N=-1;break;case"e":t=J.width+J.xoffset;N=-1;break;case"se":t=J.width+J.xoffset;N=-1;break;case"n":s=J.height+J.yoffset;break;case"s":s=J.height+J.yoffset;N=-1;break;default:break}}var K=(H.shadow!=undefined)?H.shadow:this.shadow;var A=(H.fill!=undefined)?H.fill:this.fill;var C=parseInt(B.canvas.style.width);var I=parseInt(B.canvas.style.height);var Q=C-t-2*this.padding;var Y=I-s-2*this.padding;var M=Math.min(Q,Y);var Z=M;this._sliceAngles=[];var v=this.sliceMargin;if(this.fill==false){v+=this.lineWidth}var q;var G=0;var R,ab,aa,ac;var D=this.startAngle/180*Math.PI;for(var X=0,W=z.length;XMath.PI){G=Math.max(q,G)}}if(this.diameter!=null&&this.diameter>0){this._diameter=this.diameter-2*G}else{this._diameter=Z-2*G}if(this._diameter<6){e.jqplot.log("Diameter of pie too small, not rendering.");return}var S=this._radius=this._diameter/2;this._center=[(C-N*t)/2+N*t+G*Math.cos(D),(I-N*s)/2+N*s+G*Math.sin(D)];if(this.shadow){for(var X=0,W=z.length;X=this.dataLabelThreshold){var F,V=(this._sliceAngles[X][0]+this._sliceAngles[X][1])/2,U;if(this.dataLabels=="label"){F=this.dataLabelFormatString||"%s";U=e.jqplot.sprintf(F,z[X][0])}else{if(this.dataLabels=="value"){F=this.dataLabelFormatString||"%d";U=e.jqplot.sprintf(F,this.data[X][1])}else{if(this.dataLabels=="percent"){F=this.dataLabelFormatString||"%d%%";U=e.jqplot.sprintf(F,z[X][2]*100)}else{if(this.dataLabels.constructor==Array){F=this.dataLabelFormatString||"%s";U=e.jqplot.sprintf(F,this.dataLabels[X])}}}}var p=(this._radius)*this.dataLabelPositionFactor+this.sliceMargin+this.dataLabelNudge;var P=this._center[0]+Math.cos(V)*p+this.canvas._offsets.left;var O=this._center[1]+Math.sin(V)*p+this.canvas._offsets.top;var u=e(''+U+"").insertBefore(o.eventCanvas._elem);if(this.dataLabelCenterOn){P-=u.width()/2;O-=u.height()/2}else{P-=u.width()*Math.sin(V/2);O-=u.height()/2}P=Math.round(P);O=Math.round(O);u.css({left:P,top:O})}}}};e.jqplot.PieAxisRenderer=function(){e.jqplot.LinearAxisRenderer.call(this)};e.jqplot.PieAxisRenderer.prototype=new e.jqplot.LinearAxisRenderer();e.jqplot.PieAxisRenderer.prototype.constructor=e.jqplot.PieAxisRenderer;e.jqplot.PieAxisRenderer.prototype.init=function(o){this.tickRenderer=e.jqplot.PieTickRenderer;e.extend(true,this,o);this._dataBounds={min:0,max:100};this.min=0;this.max=100;this.showTicks=false;this.ticks=[];this.showMark=false;this.show=false};e.jqplot.PieLegendRenderer=function(){e.jqplot.TableLegendRenderer.call(this)};e.jqplot.PieLegendRenderer.prototype=new e.jqplot.TableLegendRenderer();e.jqplot.PieLegendRenderer.prototype.constructor=e.jqplot.PieLegendRenderer;e.jqplot.PieLegendRenderer.prototype.init=function(o){this.numberRows=null;this.numberColumns=null;this.width=null;e.extend(true,this,o)};e.jqplot.PieLegendRenderer.prototype.draw=function(){var t=this;if(this.show){var C=this._series;this._elem=e(document.createElement("table"));this._elem.addClass("jqplot-table-legend");var F={position:"absolute"};if(this.background){F.background=this.background}if(this.border){F.border=this.border}if(this.fontSize){F.fontSize=this.fontSize}if(this.fontFamily){F.fontFamily=this.fontFamily}if(this.textColor){F.textColor=this.textColor}if(this.marginTop!=null){F.marginTop=this.marginTop}if(this.marginBottom!=null){F.marginBottom=this.marginBottom}if(this.marginLeft!=null){F.marginLeft=this.marginLeft}if(this.marginRight!=null){F.marginRight=this.marginRight}this._elem.css(F);var J=false,B=false,o,z;var D=C[0];var q=new e.jqplot.ColorGenerator(D.seriesColors);if(D.show){var K=D.data;if(this.numberRows){o=this.numberRows;if(!this.numberColumns){z=Math.ceil(K.length/o)}else{z=this.numberColumns}}else{if(this.numberColumns){z=this.numberColumns;o=Math.ceil(K.length/this.numberColumns)}else{o=K.length;z=1}}var I,H;var r,x,w;var y,p,A,G;var E=0;var v,u;for(I=0;I0){J=true}else{J=false}}else{if(I==o-1){J=false}else{J=true}}A=(J)?this.rowSpacing:"0";x=e(document.createElement("td"));x.addClass("jqplot-table-legend jqplot-table-legend-swatch");x.css({textAlign:"center",paddingTop:A});v=e(document.createElement("div"));v.addClass("jqplot-table-legend-swatch-outline");if(p!==""){v.attr("title",p)}u=e(document.createElement("div"));u.addClass("jqplot-table-legend-swatch");u.css({backgroundColor:G,borderColor:G});x.append(v.append(u));w=e(document.createElement("td"));w.addClass("jqplot-table-legend jqplot-table-legend-label");w.css("paddingTop",A);if(this.escapeHtml){w.text(y)}else{w.html(''+y+"")}if(B){w.prependTo(r);x.prependTo(r)}else{x.appendTo(r);w.appendTo(r)}J=true}E++}}}}return this._elem};e.jqplot.PieRenderer.prototype.handleMove=function(q,p,t,s,r){if(s){var o=[s.seriesIndex,s.pointIndex,s.data];r.target.trigger("jqplotDataMouseOver",o);if(r.series[o[0]].highlightMouseOver&&!(o[0]==r.plugins.pieRenderer.highlightedSeriesIndex&&o[1]==r.series[o[0]]._highlightedPoint)){r.target.trigger("jqplotDataHighlight",o);d(r,o[0],o[1])}}else{if(s==null){k(r)}}};function c(s,r,p){p=p||{};p.axesDefaults=p.axesDefaults||{};p.legend=p.legend||{};p.seriesDefaults=p.seriesDefaults||{};var o=false;if(p.seriesDefaults.renderer==e.jqplot.PieRenderer){o=true}else{if(p.series){for(var q=0;q
© 2015 - 2025 Weber Informatics LLC | Privacy Policy