text: !function(){"use strict";function e(){function e(){return Math.floor(65536*(1+Math.random())).toString(16).substring(1)}return e()+e()+"_"+e()}String.prototype.capitalizeFirstLetter=function(){return this.charAt(0).toUpperCase()+this.slice(1)},String.prototype.replaceAll=function(e,t){var n=new RegExp(e,"g");return this.replace(n,t)},angular.module("piemix.modules",["ngSanitize","ui.bootstrap"]).directive("pieMix",["$parse",function(t){return{restrict:"AEC",scope:{slices:"=",config:"=",callbackOnClick:"&"},templateUrl:"template/piemix/template.html",controller:["$scope","$timeout","$element","$attrs","$parse",function(t,n,r,i,a){var o=this;o._generateCoordinates=function(e,t,n){var r=e+"deg_"+t+"_rad"+n.toString();if("undefined"!=typeof o.coordinates[r]&&null!=o.coordinates[r])return o.coordinates[r];var i=0,a=0,c=Math.abs(t*Math.sin(.0174533*e)),d=Math.abs(t*Math.cos(.0174533*e));return e>=0&&90>=e?(i=n.x+c,a=n.y-d):e>=90&&180>=e?(i=n.x+c,a=n.y+d):e>=180&&270>=e?(i=n.x-c,a=n.y+d):(i=n.x-c,a=n.y-d),o.coordinates[r]={x:Math.ceil(i),y:Math.ceil(a)},o.coordinates[r]},o._generatePies=function(t,n,r){var i=_.reduce(t,function(e,t){return e+t.value},0),a=0;_.each(t,function(t,c){var d=null!=r?r.rad:o.baseRadius,l=o.baseRadius;_(n-2).times(function(e){l=o.radiusIncrementFactor*l}),d+=l;var u=360;"undefined"!=typeof r&&null!=r&&"undefined"!=typeof r.deg&&null!=r.deg&&(u=r.deg);var s=Math.floor(t.value/i*u),f=a+s,g=a+s+("undefined"!=typeof t.degStart&&null!=t.degStart&&t.degStart!={}?t.degStart:0),x=a+(g-a)/2,p=o._generateCoordinates(a,d,o.centerXY),y=o._generateCoordinates(x,d,o.centerXY),h=o._generateCoordinates(x,d+15,o.centerXY),m=o._generateCoordinates(g,d,o.centerXY),v=0;s>180&&(v=1),t._uid=e(),t.rad=d,t.deg=s,t.degStart=f-s,t.effectiveDeg=g,t.midDeg=x,t.degEnd=f,t.startXY=p,t.midXY=y,t.offsetMidXY=h,t.endXY=m,t.pathCoeff=v,t.activecolor=t.color,t.priority=n;var X="";X=360!=t.effectiveDeg?"M"+t.startXY.x+" "+t.startXY.y+" A "+t.rad+" "+t.rad+", 0, "+t.pathCoeff+", 1, "+t.endXY.x+" "+t.endXY.y+" L "+o.centerXY.x+" "+o.centerXY.y+" Z":"M "+o.centerXY.x+" "+o.centerXY.y+" m "+-t.rad+" 0 a "+t.rad+" "+t.rad+" 0 1 1 "+2*t.rad+" 0 a "+t.rad+" "+t.rad+" 0 1 1 "+-(2*t.rad)+" 0",t.d=X;var Y=_.clone(t);if(delete Y.child,o.generatedPies.push(Y),"undefined"!=typeof t.child&&t.child!={}&&t.child.length>0){var l=o.baseGap;_(n-2).times(function(e){l+=o.gapIncrementFactor*o.baseGap});var C=t.rad+l;t.rad=t.rad+l;var b="M "+o.centerXY.x+" "+o.centerXY.y+" m "+-C+" 0 a "+C+" "+C+" 0 1 1 "+2*C+" 0 a "+C+" "+C+" 0 1 1 "+-(2*C)+" 0",S={d:b};S.priority=n+1,S.activecolor=S.color=o.gapColor,S.nobox=!0,o.generatedPies.push(S),o._generatePies(t.child,n+2,t)}a=f})},o._calDeepLength=function(e){var t=0;return e.length>0&&(t+=1),_.each(e,function(e){"undefined"!=typeof e.child&&e.child!={}&&e.child.length>0&&(t+=o._calDeepLength(e.child))}),t},o._calMaxRadius=function(e){for(var t=o._calDeepLength(e),n=o.baseRadius,r=0;t-1>r;)n+=o.baseRadius*o.radiusIncrementFactor,r+=1;var i=o.baseGap,a=i;return _(t).times(function(e){_(e).times(function(e){a+=o.gapIncrementFactor*o.baseGap}),i+=a}),n+i+20},o.getContainerWidth=function(){return"undefined"!=typeof r&&null!=r?r.width():2*o._maxRad},o.getContainerHeight=function(){return"undefined"!=typeof r&&null!=r?r.height():2*o._maxRad},o._getCenterXY=function(e,t){o._maxRad=o._calMaxRadius(e);var n=o.getContainerWidth()/2;return t="undefined"!==t&&t!={}&&null!=t?t:0,{x:n,y:o._maxRad+2*t}},o._calcQuadrants=function(){var e={},t=o.getContainerWidth(),n=(o.getContainerHeight(),o.centerXY),r=o.gapToLabel,i=o._maxRad;return t-30>=i+r?(e.NE=e.SE={x:n.x+i+r,y:10},e.NW=e.SW={x:n.x-i-r,y:10},e):void 0},o._getQuadrantKey=function(e){var t="";return e>=0&&90>=e?t="NE":e>90&&180>=e?t="SE":e>180&&270>=e?t="SW":e>270&&360>=e&&(t="NW"),t},o._drawHelpBoxes=function(){var e=50,t=_.map(angular.copy(o.generatedPies),function(e,t){return 1!=e.nobox?{midXY:e.midXY,midDeg:e.midDeg,offsetMidXY:e.offsetMidXY,priority:e.priority,rad:e.rad,id:e.id,title:e.title,side:e.midXY.x==o.centerXY.x?0:e.midXY.x>o.centerXY.x?1:-1}:{}}),n=_.sortBy(_.filter(t,function(e){return 1==e.side}),function(e){return e.midDeg}),r=_.sortBy(_.filter(t,function(e){return 0==e.side||-1==e.side}),function(e){return-e.midDeg}),i=o._calcQuadrants(),a=null;_.each(n,function(t,n){var r=o._getQuadrantKey(t.midDeg),c=_.clone(i[r]),d=t.offsetMidXY;if(null!=a&&d.y-a.y<e){var l=e-(d.y-a.y),u={};"NE"==r?(d.y=d.y+l,d.x=d.x+l):"SE"==r&&(u=o._generateCoordinates(t.midDeg,t.rad+30+l,o.centerXY),d=u)}var s={x:c.x,y:d.y},f={x:c.x+100,y:d.y},g=t.midXY;t._ptr=g.x+","+g.y+" "+d.x+","+d.y+" "+s.x+","+s.y+" "+f.x+","+f.y,t.colorBox={x:s.x,y:s.y+4},t.textBox={x:s.x+24,y:s.y+16},a=d}),a=null,_.each(r,function(t,n){var r=o._getQuadrantKey(t.midDeg),c=_.clone(i[r]),d=t.offsetMidXY;if(null!=a&&d.y-a.y<e){var l=e-(d.y-a.y),u={};"NW"==r?(d.y=d.y+l,d.x=d.x-l):"SW"==r&&(u=o._generateCoordinates(t.midDeg,t.rad+30+l,o.centerXY),d=u)}var s={x:c.x,y:d.y},f={x:c.x-100,y:d.y},g=t.midXY;t.colorBox={x:s.x-100,y:s.y+4},t.textBox={x:s.x-100+24,y:s.y+16},t._ptr=f.x+","+f.y+" "+s.x+","+s.y+" "+d.x+","+d.y+" "+g.x+","+g.y,a=d}),_.each(o.generatedPies,function(e){if(1!=e.nobox){var t=e.midXY.x==o.centerXY.x?0:e.midXY.x>o.centerXY.x?1:-1;if(1==t){var i=_.find(n,function(t){return t.id==e.id});"undefined"!=typeof i&&(e.ptr=i._ptr,e.colorBox=i.colorBox,e.textBox=i.textBox,e.fillOpacity=1)}else if(-1==t){var i=_.find(r,function(t){return t.id==e.id});"undefined"!=typeof i&&(e.ptr=i._ptr,e.colorBox=i.colorBox,e.textBox=i.textBox,e.fillOpacity=1)}}})},o.hoverPie=function(e){return 1!=e.nobox?"#000000":e.color},o._startGenerating=function(t){o.generatedPies=[],o.centerXY=o._getCenterXY(t,5),o.svgWidth=o.getContainerWidth(),o.svgHeight=Math.max(o.getContainerHeight(),2*o._maxRad+100),o._generatePies(t,1,null),1==o.showStrokeCircleAtCenter&&(o.strokeCircle={cx:o.centerXY.x,cy:o.centerXY.y,r:.5*o.baseRadius,fill:o.strokeColor});({_uid:e(),activecolor:o.strokeColor,color:o.strokeColor});n(o._drawHelpBoxes,500)},o._init=function(e){this.baseRadius=angular.copy(o.config.baseRadius)||100,this.radiusIncrementFactor=angular.copy(o.config.radiusIncrementFactor)||.66,this.gapToLabel=angular.copy(o.config.gapToLabel)||60,this.strokeColor=angular.copy(o.config.strokeColor)||"#fff",this.strokeWidth=angular.copy(o.config.strokeWidth)||0,this.baseGap=angular.copy(o.config.baseGap)||0,this.gapIncrementFactor=angular.copy(o.config.gapIncrementFactor)||0,this.gapColor=angular.copy(o.config.gapColor)||"#fff",this.showLabels=angular.copy(o.config.showLabels),this.showStrokeCircleAtCenter=angular.copy(o.config.showStrokeCircleAtCenter),o.coordinates={},o.generatedPies=[],o.centerXY={},o._maxRad={},o._startGenerating(e)},o.pieSliceClicked=function(e){o.callbackOnClick({data:e}),"function"==typeof o.config.pieSliceClicked&&o.config.pieSliceClicked({data:e})},o.config.highlightPie=function(e){_.each(o.generatedPies,function(t){t.id==e&&(t.activecolor="#000")})},o.config.dehighlightPie=function(e){_.each(o.generatedPies,function(t){t.id==e&&(t.activecolor=t.color)})}}],controllerAs:"piemixctrl",bindToController:!0,replace:!0,link:function(e,n,r,i){var a=[];angular.forEach(["slices","config"],function(n){if(r[n]){t(r[n]);a.push(e.$parent.$watch(angular.bind(i,function(){return this[n]}),function(e){i._init(angular.copy(i.slices))},!0))}})}}}])}();
  !function(){"use strict";var t={pieMixMasterTmpl:'        <div class="pie-mix-holder" ng-style="{\'height\': piemixctrl.svgHolderHeight + \'px\'}">            <svg height="{{piemixctrl.svgHeight}}" width="{{piemixctrl.svgWidth}}" version="1.1" xmlns="http://www.w3.org/2000/svg">                <path tabindex="0" ng-attr-d="{{path.d}}" ng-attr-priority="{{path.priority}}" ng-style="{\'fill\' : path.activecolor, \'stroke\':piemixctrl.strokeColor, \'stroke-width\':piemixctrl.strokeWidth}" ng-repeat="path in piemixctrl.generatedPies  | orderBy:\'priority\':\'false\'" ng-click="piemixctrl.pieSliceClicked(path)" ng-mouseenter="path.activecolor = piemixctrl.hoverPie(path)" ng-mouseleave="path.activecolor = path.color"/>                <rect ng-if="piemixctrl.showLabels != false && path.nobox != true" ng-attr-x="{{path.colorBox.x}}" ng-attr-y="{{path.colorBox.y}}" width="15" height="15" style="fill-opacity:0;" ng-click="piemixctrl.pieSliceClicked(path)" ng-style="{\'fill\': path.activecolor, \'fill-opacity\': path.fillOpacity}" ng-repeat="path in piemixctrl.generatedPies  | orderBy:\'priority\':\'false\'" ng-mouseenter="path.activecolor = \'#000\'" ng-mouseleave="path.activecolor = path.color"/>                <text ng-if="piemixctrl.showLabels != false && path.nobox != true" ng-attr-x="{{path.textBox.x}}" ng-attr-y="{{path.textBox.y}}" ng-repeat="path in piemixctrl.generatedPies  | orderBy:\'priority\':\'false\'">{{path.title}}</text>                <polyline ng-if="piemixctrl.showLabels != false && path.nobox != true" ng-attr-points="{{path.ptr}}" fill="none" stroke="#000" ng-attr-stroke-width="{{path.activecolor != \'#000\' ? 1 : 2}}" ng-attr-stroke-opacity="{{path.activecolor != \'#000\' ? 0.50 : 1}}" stroke-linecap="round" stroke-dasharray="1, 5" ng-repeat="path in piemixctrl.generatedPies  | orderBy:\'priority\':\'false\'"/>                <circle ng-if="piemixctrl.showStrokeCircleAtCenter == true" ng-attr-cx="{{piemixctrl.strokeCircle.cx}}" ng-attr-cy="{{piemixctrl.strokeCircle.cy}}" ng-attr-r="{{piemixctrl.strokeCircle.r}}" ng-style="{\'fill\' : piemixctrl.strokeCircle.fill, \'stroke\':piemixctrl.strokeColor, \'stroke-width\':piemixctrl.strokeWidth}"/>            </svg>        </div>    '};angular.module("piemix.modules").run(["$templateCache",function(e){e.put("template/piemix/template.html",t.pieMixMasterTmpl)}])}();