UNPKG

@fusioncharts/widgets

Version:

FusionCharts JavaScript charting framework

1 lines 64.8 kB
"use strict";var _interopRequireDefault=require("@babel/runtime/helpers/interopRequireDefault");exports.__esModule=true;exports.default=void 0;var _inheritsLoose2=_interopRequireDefault(require("@babel/runtime/helpers/inheritsLoose"));var _lib=require("@fusioncharts/core/src/lib");var _componentInterface=require("@fusioncharts/core/src/component-interface");var _pie2d=require("@fusioncharts/charts/src/dataset/pie2d");var _funnelpyramidbase=_interopRequireDefault(require("./funnelpyramidbase.animation"));var _dependencyManager=require("@fusioncharts/core/src/dependency-manager");var PATTERN_TYPES=["line","circle","square"];var UNDEF,showHoverEffectStr=_lib.preDefStr.showHoverEffectStr,noneStr="none",PXSTRING="px",fillStr="fill",EASE_IN="easeIn",NORMALSTRING="normal",math=Math,mathRound=math.round,mathCeil=math.ceil,mathMax=math.max,mathMin=math.min,mathPow=math.pow,mathSqrt=math.sqrt,EMPTY_OBJ={},colorStrings=_lib.preDefStr.colors,COLOR_000000=colorStrings.c000000,POSITION_START=_lib.preDefStr.POSITION_START,POSITION_MIDDLE=_lib.preDefStr.POSITION_MIDDLE,pathStr="path",zeroCommaHundredStr="0,100",EVENTARGS="eventArgs",win=window,userAgent=win.navigator.userAgent,isIE=/msie/i.test(userAgent)&&!win.opera,HEXCODE=_lib.regex.hexcode,TRACKER_FILL="rgba(192,192,192,"+(isIE?.002:1e-6)+")",dropHash=_lib.regex.dropHash,isObject=function isObject(obj){return typeof obj==="object"},isString=function isString(s){return typeof s==="string"},defined=function defined(obj){return obj!==UNDEF&&obj!==null},_getTooltipMacroStub=function getTooltipMacroStub(options){return{formattedValue:options.formatedVal,label:options.name,percentValue:options.pValue,sum:options.sum,unformattedSum:options.sumValue}},M="M",A="A",L="L",Z="Z",startsRGBA=_lib.regex.startsRGBA,Color=function Color(input){var rgba=[],result;function init(inp){result=/rgba\(\s*([0-9]{1,3})\s*,\s*([0-9]{1,3})\s*,\s*([0-9]{1,3})\s*,\s*([0-9]?(?:\.[0-9]+)?)\s*\)/.exec(inp);if(result){rgba=[parseInt(result[1],10),parseInt(result[2],10),parseInt(result[3],10),parseFloat(result[4])]}else{result=/#([a-fA-F0-9]{2})([a-fA-F0-9]{2})([a-fA-F0-9]{2})/.exec(inp);if(result){rgba=[parseInt(result[1],16),parseInt(result[2],16),parseInt(result[3],16),1]}}}function get(format){var ret;if(rgba&&!isNaN(rgba[0])){if(format==="rgb"){ret="rgb("+rgba[0]+","+rgba[1]+","+rgba[2]+")"}else if(format==="hex"){ret="#"+(COLOR_000000+(rgba[0]<<16|rgba[1]<<8|rgba[2]).toString(16)).slice(-6)}else if(format==="a"){ret=rgba[3]}else{ret="rgba("+rgba.join(",")+")"}}else{ret=input}return ret}function brighten(alpha){if(!isNaN(alpha)&&alpha!==0){var i;for(i=0;i<3;i++){rgba[i]+=parseInt(alpha*255,10);if(rgba[i]<0){rgba[i]=0}if(rgba[i]>255){rgba[i]=255}}}return this}function setOpacity(alpha){rgba[3]=alpha;return this}init(input);return{get:get,brighten:brighten,setOpacity:setOpacity}};(0,_dependencyManager.addDep)({name:"funnelPyramidBaseAnimation",type:"animationRule",extension:_funnelpyramidbase.default});var FunnelPyramidBaseDataset=function(_ComponentInterface){function FunnelPyramidBaseDataset(){var _this;_this=_ComponentInterface.call(this)||this;_this.components={};_this.utils=function(_contextParam){var _context=_contextParam;function ArrayableObj(){var _map=[],_eLength=0;this.set=function(key,value){_eLength++;_map[key]=value};this.get=function(key){return _map[key]};this.getAll=function(){return _map};this.mergeWith=function(anotherArray){var sArr,itemIndex,item,newArr=_map.slice(0);if(anotherArray instanceof Array){sArr=anotherArray}else if(anotherArray instanceof ArrayableObj){sArr=anotherArray.getAll()}else{return}for(itemIndex in sArr){item=sArr[itemIndex];if(newArr[itemIndex]){continue}newArr[itemIndex]=item}return newArr};this.getEffectiveLength=function(){return _eLength}}ArrayableObj.prototype.constructor=ArrayableObj;function DistributionMatrix(length){this.distributionLength=length;this.distributedMatrix=[];this.altDistributedMatrix=[];this.nonDistributedMatrix={};this.forcePushObj={};this.flags={exhaustion:false}}DistributionMatrix.prototype.constructor=DistributionMatrix;DistributionMatrix.prototype.push=function(item,rangeBottom){this.nonDistributedMatrix[rangeBottom]=this.nonDistributedMatrix[rangeBottom]||[];this.nonDistributedMatrix[rangeBottom].push(item)};DistributionMatrix.prototype.forcePush=function(item,index){this.forcePushObj[index]=item};DistributionMatrix.prototype.distribute=function(legendSkip){var datasetStore=_context,distributionItems,alternateSwitch=true,distributedMatrix=new ArrayableObj,alternateDistributedMatrix=new ArrayableObj,orphanMatrix=new ArrayableObj,altOrphanMatrix=new ArrayableObj,flags=this.flags,currentMatrix,distributionIndexAlt,distributionIndex,index,length,currentItem,absIndex=0,dataLength=datasetStore.getDataLength();if(legendSkip){if(dataLength-this.distributionLength>0){for(distributionIndexAlt in this.nonDistributedMatrix){distributionItems=this.nonDistributedMatrix[distributionIndexAlt];for(index=1;index<distributionItems.length;index++){currentItem=distributionItems[index];currentItem.dontPlot=true;currentItem.displayValue=_lib.BLANK}}}}else{if(dataLength-2*this.distributionLength>0){for(distributionIndexAlt in this.nonDistributedMatrix){distributionItems=this.nonDistributedMatrix[distributionIndexAlt];for(index=1;index<distributionItems.length-1;index++){currentItem=distributionItems[index];currentItem.dontPlot=true;currentItem.displayValue=_lib.BLANK}}}}if(dataLength>this.distributionLength&&!legendSkip){flags.exhaustion=true;for(distributionIndexAlt in this.nonDistributedMatrix){distributionItems=this.nonDistributedMatrix[distributionIndexAlt];for(index=0,length=distributionItems.length;index<length;index++){currentItem=distributionItems[index];if(!currentItem.dontPlot){alternateSwitch?currentMatrix=distributedMatrix:currentMatrix=alternateDistributedMatrix;if(currentMatrix.getEffectiveLength()>parseInt(distributionIndexAlt,10)){currentItem.distributionFactor=currentMatrix.getEffectiveLength()-1-distributionIndexAlt}else{currentItem.distributionFactor=0}}else{alternateSwitch?currentMatrix=orphanMatrix:currentMatrix=altOrphanMatrix}currentMatrix.set(absIndex++,currentItem);alternateSwitch=!alternateSwitch}}this.distributedMatrix=distributedMatrix.mergeWith(orphanMatrix);this.altDistributedMatrix=alternateDistributedMatrix.mergeWith(altOrphanMatrix)}else{for(distributionIndex in this.nonDistributedMatrix){distributionItems=this.nonDistributedMatrix[distributionIndex];for(index=0,length=distributionItems.length;index<length;index++){currentItem=distributionItems[index];if(!currentItem.dontPlot){currentMatrix=distributedMatrix;if(currentMatrix.getEffectiveLength()>parseInt(distributionIndex,10)){currentItem.distributionFactor=currentMatrix.getEffectiveLength()-1-distributionIndex}else{currentItem.distributionFactor=0}}else{currentMatrix=orphanMatrix}currentMatrix.set(absIndex++,currentItem)}}this.distributedMatrix=distributedMatrix.mergeWith(orphanMatrix)}};DistributionMatrix.prototype.getDistributedResult=function(){var datasetStore=_context,chart=datasetStore.getFromEnv("chart"),chartConfig=chart.config,legend=chart.getFromEnv("legend"),conf=datasetStore.config,alignmentType=conf.alignmentType,suggestion,matrix=[],isLegendRight=chart.isLegendRight,allowedRightX=chartConfig.width-conf.blankSpace;if(chartConfig.showLegend&&legend.config.width){isLegendRight&&(allowedRightX-=legend.config.width+chartConfig.marginRight)}else{isLegendRight=0}chart.isLegendRight=isLegendRight;this.distribute(isLegendRight);if(isLegendRight){suggestion=alignmentType["default"];matrix.push(this.distributedMatrix)}else{suggestion=this.flags.exhaustion?alignmentType.alternate:alignmentType["default"];this.flags.exhaustion?[].push.call(matrix,this.distributedMatrix,this.altDistributedMatrix):matrix.push(this.distributedMatrix)}return{forceMatrix:this.forcePushObj,suggestion:suggestion,matrix:matrix}};return{DistributionMatrix:DistributionMatrix,setContext:function setContext(context){_context=context},invokeHookFns:function invokeHookFns(){var fn,params=[],ctx=_context;switch(arguments.length){case 3:ctx=arguments[2];case 2:params=arguments[1];case 1:fn=arguments[0];break;default:return}fn&&typeof fn==="function"&&fn.apply(ctx,params)},copyProperties:function copyProperties(fromObject,toObject,mappingArray){var index,length,confArr,fromName,toName,convertFunction,defaultValue,additionalFn,DEFAULT_FN=_lib.stubFN;function getDefaultValue(key){var nKey;if(typeof key==="string"&&key.indexOf("$")===0){nKey=key.substring(1);return toObject[nKey]}if(typeof key==="function"){return key.call(_context,toObject)}return key}for(index=0,length=mappingArray.length;index<length;index++){confArr=mappingArray[index];fromName=confArr[0];toName=confArr[1];convertFunction=confArr[2];defaultValue=getDefaultValue(confArr[3]);additionalFn=confArr[4]||DEFAULT_FN;toObject[toName]=convertFunction(fromObject[fromName],defaultValue);additionalFn(toObject)}},sortObjArrByKey:function sortObjArrByKey(objArr,valueKey){return objArr.sort((function(obj1,obj2){return Math.abs(obj2[valueKey])-Math.abs(obj1[valueKey])}))},getSumValueOfObjArrByKey:function getSumValueOfObjArrByKey(objArr,valueKey){var index,length,total=0;for(index=0,length=objArr.length;index<length;index++){total+=parseFloat(objArr[index][valueKey],10)}return total}}};_this.hide=function(plotArr,currentDsLengthParam){var index,animationManager=this.getFromEnv("animationManager"),callbackFn=function callbackFn(){this.hide()},plot,currentDsLength=currentDsLengthParam;if(!plotArr||plotArr.length===0){return}currentDsLength=currentDsLength<2&&this.getName()==="funnel"?0:currentDsLength;for(index=plotArr.length-1;index>=currentDsLength;index--){plot=plotArr[index].getGraphicalElement();if(plot.graphic){plot.graphic.front&&animationManager.setAnimation({el:plot.graphic.front,callback:callbackFn,component:this});plot.graphic.back&&animationManager.setAnimation({el:plot.graphic.back,callback:callbackFn,component:this});plot.graphic.funnel2D&&animationManager.setAnimation({el:plot.graphic.funnel2D,callback:callbackFn,component:this});plot.graphic.lighterHalf&&animationManager.setAnimation({el:plot.graphic.lighterHalf,callback:callbackFn,component:this});plot.graphic.darkerHalf&&animationManager.setAnimation({el:plot.graphic.darkerHalf,callback:callbackFn,component:this});plot.graphic.borderElement&&animationManager.setAnimation({el:plot.graphic.borderElement,callback:callbackFn,component:this});plot.graphic.centerLight&&animationManager.setAnimation({el:plot.graphic.centerLight,callback:callbackFn,component:this});plot.graphic.centerLight1&&animationManager.setAnimation({el:plot.graphic.centerLight1,callback:callbackFn,component:this});plot.graphic.toptop&&animationManager.setAnimation({el:plot.graphic.toptop,callback:callbackFn,component:this});plot.graphic.topLight&&animationManager.setAnimation({el:plot.graphic.topLight,callback:callbackFn,component:this});plot.graphic.topLight1&&animationManager.setAnimation({el:plot.graphic.topLight1,callback:callbackFn,component:this})}plot.dataLabel&&animationManager.setAnimation({el:plot.dataLabel,callback:callbackFn,component:this});plot.trackerObj&&animationManager.setAnimation({el:plot.trackerObj,callback:callbackFn,component:this})}};_this.pyramidFunnelShape=function(){var attrList={y:true,R1:true,R2:true,h:true,r3dFactor:true,color:true,opacity:true,fill:true,stroke:true,strokeColor:true,strokeAlpha:true,"stroke-width":true},minRadius=.01,getArcPath=function getArcPath(endX,endY,rX,rY,isClockWise,isLargeArc){return[A,rX,rY,0,isLargeArc,isClockWise,endX,endY]},calcPoints=function calcPoints(a1,b1,h1,a2,b2,h2){var alpha=mathPow(a2,2)-mathPow(a1,2),beta=-2*(mathPow(a2,2)*h1-mathPow(a1,2)*h2),gamma=mathPow(a1*b2,2)+mathPow(a2*h1,2)-mathPow(a2*b1,2)-mathPow(a1*h2,2),k=mathSqrt(mathPow(beta,2)-4*alpha*gamma),c1=(-beta+k)/(2*alpha),c2=(-beta-k)/(2*alpha),oneHND=100,objPoints,c,m1,m2,p1,p2,p3,p4,i;if(c1<h2&&c1>h1){c=c2}else if(c2<h2&&c2>h1){c=c1}m1=mathSqrt((mathPow(c-h1,2)-mathPow(b1,2))/mathPow(a1,2));m2=-m1;p1={x:mathRound(mathPow(a1,2)*m1/(c-h1)*oneHND)/oneHND,y:mathRound((mathPow(b1,2)/(c-h1)+h1)*oneHND)/oneHND};p2={x:mathRound(mathPow(a2,2)*m1/(c-h2)*oneHND)/oneHND,y:mathRound((mathPow(b2,2)/(c-h2)+h2)*oneHND)/oneHND};p3={x:mathRound(mathPow(a1,2)*m2/(c-h1)*oneHND)/oneHND,y:mathRound((mathPow(b1,2)/(c-h1)+h1)*oneHND)/oneHND};p4={x:mathRound(mathPow(a2,2)*m2/(c-h2)*oneHND)/oneHND,y:mathRound((mathPow(b2,2)/(c-h2)+h2)*oneHND)/oneHND};objPoints={topLeft:p3,bottomLeft:p4,topRight:p1,bottomRight:p2};for(i in objPoints){if(isNaN(objPoints[i].x)||isNaN(objPoints[i].y)){if(i==="topLeft"||i==="bottomLeft"){objPoints[i].x=-a1}else{objPoints[i].x=a1}objPoints[i].y=i==="bottomRight"||i==="bottomLeft"?h2:h1}}return objPoints},getFunnel3DShapeArgs=function getFunnel3DShapeArgs(x,y,R1,R2,h,r3dFactor,isHollow){var y2=y+h,R3=R1*r3dFactor,R4=R2*r3dFactor,shapearge,objPoints=calcPoints(R1,R3,y,R2,R4,y2),topLeft=objPoints.topLeft,bottomLeft=objPoints.bottomLeft,topRight=objPoints.topRight,bottomRight=objPoints.bottomRight,X1=x+topLeft.x,X2=x+topRight.x,X3=x+bottomLeft.x,X4=x+bottomRight.x,y3=topLeft.y,y4=bottomLeft.y,arc1=getArcPath(X2,y3,R1,R3,0,0),arc2=getArcPath(X2,y3,R1,R3,1,1),arc3=getArcPath(X3,y4,R2,R4,1,0),arc4=getArcPath(X3,y4,R2,R4,0,1);shapearge={front:[M,X1,y3].concat(arc1,[L,X4,y4],arc3,[Z]),back:[M,X1,y3].concat(arc2,[L,X4,y4],arc4,[Z]),silhuette:[M,X1,y3].concat(arc2,[L,X4,y4],arc3,[Z])};if(!isHollow){shapearge.top=[M,X1,y3].concat(arc1,[L,X2,y3],getArcPath(X1,y3,R1,R3,0,1),[Z])}return shapearge},getPyramid3DShapeArgs=function getPyramid3DShapeArgs(xParam,yParam,R1Param,R2Param,hParam,r3dFactorParam,is2DParam,rendererParam,isFunnelParam,isHollowParam){var x=xParam,y=yParam,R1=R1Param,R2=R2Param,h=hParam,r3dFactor=r3dFactorParam,is2D=is2DParam,renderer=rendererParam,isFunnel=isFunnelParam,isHollow=isHollowParam;if(isObject(x)){y=x.y;R1=x.R1;R2=x.R2;h=x.h;r3dFactor=x.r3dFactor;is2D=x.is2D;isHollow=x.isHollow;isFunnel=x.isFunnel;renderer=x.renderer;x=x.x}var X1=x-R1,X2=x+R1,X3=x-R2,X4=x+R2,y2=y+h,shapeArgs,R3,R4,lightLength,lightLengthH,lightLengthH1,lightWidth;if(is2D){shapeArgs={silhuette:[M,X1,y,L,X2,y,X4,y2,X3,y2,Z]};if(!isFunnel){x=Math.round(x);shapeArgs.lighterHalf=[M,X1,y,L,x,y,x,y2,X3,y2,Z];shapeArgs.darkerHalf=[M,x,y,L,X2,y,X4,y2,x,y2,Z]}}else if(isFunnel){shapeArgs=getFunnel3DShapeArgs(x,y,R1||minRadius,R2||minRadius,h,r3dFactor,isHollow,renderer)}else{R3=R1*r3dFactor;R4=R2*r3dFactor;lightLength=mathMin(5,R1);lightLengthH=mathMin(2,2*R3);lightLengthH1=mathMin(2,lightLengthH);lightWidth=lightLengthH1/r3dFactor;shapeArgs={top:[M,X1,y,L,x,y+R3,X2,y,x,y-R3,Z],front:[M,X1,y,L,x,y+R3,X2,y,X4,y2,x,y2+R4,X3,y2,Z],topLight:[M,X1,y+.5,L,x,y+R3+.5,x,y+R3-lightLengthH,X1+lightWidth,y,Z],topLight1:[M,X2,y+.5,L,x,y+R3+.5,x,y+R3-lightLengthH1,X2-lightWidth,y,Z],silhuette:[M,X1,y,L,x,y-R3,X2,y,X4,y2,x,y2+R4,X3,y2,Z],centerLight:[M,x,y+R3,L,x,y2+R4,x-5,y2+R4,x-lightLength,y+R3,Z],centerLight1:[M,x,y+R3,L,x,y2+R4,x+5,y2+R4,x+lightLength,y+R3,Z]}}return shapeArgs},attr=function attr(hashParam,val){var key,value,element=this,color,alpha,colorObject,shapeChanged=false,colorChanged=false,lightColor,lightColor1,darkColor,attr3D=this._3dAttr,shapeArgs,colorDark,colorLight,zero100STR,lightAlphaSTR,lightShade,slantAngle,lightShadeStop,hash=hashParam;if(isString(hash)&&defined(val)){key=hash;hash={};hash[key]=val}if(isString(hash)){if(attrList[hash]){element=this._3dAttr[hash]}else{element=this._attr(hash)}}else{for(key in hash){value=hash[key];if(attrList[key]){attr3D[key]=value;if(key===fillStr){if(value&&value.linearGradient&&value.stops&&value.stops[0]){value=value.stops[0][1]}if(startsRGBA.test(value)){colorObject=new Color(value);color=colorObject.get("hex");alpha=colorObject.get("a")*100}else if(value&&value.FCcolor){color=value.FCcolor.color.split(_lib.COMMASTRING)[0];alpha=value.FCcolor.opacity.split(_lib.COMMASTRING)[0]}else if(HEXCODE.test(value)){color=value.replace(dropHash,_lib.HASHSTRING);alpha=(0,_lib.pluckNumber)(attr3D.opacity,100)}attr3D.color=color;attr3D.opacity=alpha;colorChanged=true}else if(key==="color"||key==="opacity"){attr3D.fill=(0,_lib.toRaphaelColor)((0,_lib.convertColor)(attr3D.color,(0,_lib.pluckNumber)(attr3D.opacity,100)));colorChanged=true}else if(key==="stroke"||key==="strokeColor"||key==="strokeAlpha"){if(attr3D.is2D){if(key==="stroke"){if(value&&value.linearGradient&&value.stops&&value.stops[0]){value=value.stops[0][1]}if(startsRGBA.test(value)){colorObject=new Color(value);color=colorObject.get("hex");alpha=colorObject.get("a")*100}else if(value&&value.FCcolor){color=value.FCcolor.color.split(_lib.COMMASTRING)[0];alpha=value.FCcolor.opacity.split(_lib.COMMASTRING)[0]}else if(HEXCODE.test(value)){color=value.replace(dropHash,_lib.HASHSTRING);alpha=(0,_lib.pluckNumber)(attr3D.opacity,100)}attr3D.strokeColor=color;attr3D.strokeAlpha=alpha}else{attr3D.stroke=(0,_lib.convertColor)(attr3D.strokeColor,(0,_lib.pluckNumber)(attr3D.strokeAlpha,100))}if(attr3D.isFunnel){this.funnel2D.attr("stroke",attr3D.stroke)}else{this.borderElement.attr("stroke",attr3D.stroke)}}}else if(key==="stroke-width"){if(attr3D.is2D){if(attr3D.isFunnel){this.funnel2D.attr(key,value)}else{this.borderElement.attr(key,value)}}}else{shapeChanged=true}}else{this._attr(key,value)}}if(attr3D.is2D){if(shapeChanged){shapeArgs=getPyramid3DShapeArgs(attr3D.x,attr3D.y,attr3D.R1,attr3D.R2,attr3D.h,attr3D.r3dFactor,attr3D.is2D);element.shadowElement.attr({path:shapeArgs.silhuette});if(attr3D.isFunnel){element.funnel2D.attr({path:shapeArgs.silhuette})}else{element.lighterHalf.attr({path:shapeArgs.lighterHalf});element.darkerHalf.attr({path:shapeArgs.darkerHalf});element.borderElement.attr({path:shapeArgs.silhuette})}}if(colorChanged){if(attr3D.isFunnel){element.funnel2D.attr(fillStr,(0,_lib.toRaphaelColor)((0,_lib.convertColor)(attr3D.color,(0,_lib.pluckNumber)(attr3D.opacity,100))))}else{if(attr3D.use3DLighting===false){colorDark=colorLight=attr3D.color}else{colorDark=(0,_lib.getDarkColor)(attr3D.color,80);colorLight=(0,_lib.getLightColor)(attr3D.color,80)}element.lighterHalf.attr(fillStr,(0,_lib.toRaphaelColor)((0,_lib.convertColor)(colorLight,(0,_lib.pluckNumber)(attr3D.opacity,100))));element.darkerHalf.attr(fillStr,(0,_lib.toRaphaelColor)((0,_lib.convertColor)(colorDark,(0,_lib.pluckNumber)(attr3D.opacity,100))))}}}else{if(shapeChanged){shapeArgs=getPyramid3DShapeArgs(attr3D.x,attr3D.y,attr3D.R1,attr3D.R2,attr3D.h,attr3D.r3dFactor,attr3D.is2D);element.shadowElement.attr(pathStr,shapeArgs.silhuette);if(attr3D.isFunnel){element.front.attr(pathStr,shapeArgs.front);element.back.attr(pathStr,shapeArgs.back);if(element.toptop&&shapeArgs.top){element.toptop.attr(pathStr,shapeArgs.top)}}else{element.front.attr(pathStr,shapeArgs.front);element.toptop.attr(pathStr,shapeArgs.top);element.topLight.attr(pathStr,shapeArgs.topLight);element.topLight1.attr(pathStr,shapeArgs.topLight1);element.centerLight.attr(pathStr,shapeArgs.centerLight);element.centerLight1.attr(pathStr,shapeArgs.centerLight1)}}if(colorChanged){color=attr3D.color;alpha=attr3D.opacity;if(attr3D.isFunnel){lightColor=(0,_lib.getLightColor)(color,60);darkColor=(0,_lib.getDarkColor)(color,60);element.back.attr(fillStr,(0,_lib.toRaphaelColor)({FCcolor:{color:darkColor+_lib.COMMASTRING+lightColor+_lib.COMMASTRING+color,alpha:alpha+_lib.COMMASTRING+alpha+_lib.COMMASTRING+alpha,ratio:"0,60,40",angle:0}}));element.front.attr(fillStr,(0,_lib.toRaphaelColor)({FCcolor:{color:color+_lib.COMMASTRING+lightColor+_lib.COMMASTRING+darkColor,alpha:alpha+_lib.COMMASTRING+alpha+_lib.COMMASTRING+alpha,ratio:"0,40,60",angle:0}}));if(element.toptop){element.toptop.attr(fillStr,(0,_lib.toRaphaelColor)({FCcolor:{color:lightColor+_lib.COMMASTRING+darkColor,alpha:alpha+_lib.COMMASTRING+alpha,ratio:zeroCommaHundredStr,angle:-65}}))}}else{lightColor=(0,_lib.getLightColor)(color,80);lightColor1=(0,_lib.getLightColor)(color,70);darkColor=(0,_lib.getDarkColor)(color,80);zero100STR=zeroCommaHundredStr;lightAlphaSTR="0,"+alpha;lightShade=color+_lib.COMMASTRING+lightColor1;slantAngle=-45;lightShadeStop=5/(attr3D.R1*attr3D.r3dFactor)*100;element.centerLight.attr(fillStr,(0,_lib.toRaphaelColor)({FCcolor:{color:lightShade,alpha:lightAlphaSTR,ratio:zero100STR,angle:0}}));element.centerLight1.attr(fillStr,(0,_lib.toRaphaelColor)({FCcolor:{color:lightShade,alpha:lightAlphaSTR,ratio:zero100STR,angle:180}}));element.topLight.attr(fillStr,(0,_lib.toRaphaelColor)({FCcolor:{color:lightColor1+_lib.COMMASTRING+lightColor1+_lib.COMMASTRING+color+_lib.COMMASTRING+color,alpha:alpha+_lib.COMMASTRING+alpha+_lib.COMMASTRING+0+_lib.COMMASTRING+0,ratio:"0,50,"+lightShadeStop+_lib.COMMASTRING+(50-lightShadeStop),angle:slantAngle}}));element.topLight1.attr(fillStr,(0,_lib.toRaphaelColor)({FCcolor:{color:lightColor1+_lib.COMMASTRING+color+_lib.COMMASTRING+darkColor,alpha:alpha+_lib.COMMASTRING+alpha+_lib.COMMASTRING+alpha,ratio:"0,50,50",angle:0}}));element.front.attr(fillStr,(0,_lib.toRaphaelColor)({FCcolor:{color:color+_lib.COMMASTRING+color+_lib.COMMASTRING+darkColor+_lib.COMMASTRING+darkColor,alpha:alpha+_lib.COMMASTRING+alpha+_lib.COMMASTRING+alpha+_lib.COMMASTRING+alpha,ratio:"0,50,0,50",angle:0}}));element.toptop.attr(fillStr,(0,_lib.toRaphaelColor)({FCcolor:{color:lightColor+_lib.COMMASTRING+color+_lib.COMMASTRING+darkColor+_lib.COMMASTRING+darkColor,alpha:alpha+_lib.COMMASTRING+alpha+_lib.COMMASTRING+alpha+_lib.COMMASTRING+alpha,ratio:"0,25,30,45",angle:slantAngle}}))}}}}return element},_shadow=function shadow(){var silhuette=this.shadowElement;if(_shadow){silhuette.shadow.apply(silhuette,arguments)}},normalizeShapes=function normalizeShapes(group,newAttrs){var shapes=["silhuette","lighterHalf","darkerHalf","centerLight","centerLight1","front","toptop","topLight","topLight1","shadowElement","funnel2D","borderElement","back"],shapeGElem,index,shapeName,oldAttrs,length;if(!group){return}oldAttrs=group._3dAttr;if(oldAttrs.isFunnel===newAttrs.isFunnel&&oldAttrs.is2D===newAttrs.is2D&&oldAttrs.isHollow===newAttrs.isHollow){return group}for(index=0,length=shapes.length;index<length;index++){shapeName=shapes[index];shapeGElem=group[shapeName];if(!shapeGElem){continue}delete group[shapeName];shapeGElem.remove()}return group},animatePathIfPresent=function animatePathIfPresent(datasetStore,parentElem){var chart=datasetStore.getFromEnv("chart");return function(elemType,pathArr,nonAnimAttr){if(nonAnimAttr===void 0){nonAnimAttr=EMPTY_OBJ}var prevEle=parentElem[elemType];if(prevEle){chart.getFromEnv("animationManager").setAnimation({el:prevEle,attr:{path:pathArr},component:datasetStore});return prevEle}datasetStore.postPlotCallback();return chart.getFromEnv("animationManager").setAnimation({el:"path",label:"path",attr:Object.assign({path:pathArr},nonAnimAttr),container:parentElem,component:datasetStore})}};return function(xParam,yParam,R1Param,R2Param,hParam,r3dFactorParam,gStrParam,is2DParam,rendererParam,isFunnelParam,isHollowParam,use3DLightingParam){var datasetStore=this,chart=datasetStore.getFromEnv("chart"),graphicsGroup=chart.getChildContainer().plotGroup,_3dAttr,Shapeargs,Shapeargs2,oldLastData=datasetStore.config.oldLastData,rect3D,squeezedFormPathObj,squeezedShapeArgs,existingGElement,animationType=EASE_IN,animOrDraw,x=xParam,y=yParam,R1=R1Param,R2=R2Param,h=hParam,r3dFactor=r3dFactorParam,gStr=gStrParam,is2D=is2DParam,renderer=rendererParam,isFunnel=isFunnelParam,isHollow=isHollowParam,use3DLighting=use3DLightingParam;if(isObject(x)){y=x.y;R1=x.R1;R2=x.R2;h=x.h;r3dFactor=x.r3dFactor;gStr=x.gStr;is2D=x.is2D;use3DLighting=x.use3DLighting;renderer=x.renderer;isHollow=x.isHollow;isFunnel=x.isFunnel;existingGElement=x.graphics;x=x.x}r3dFactor=(0,_lib.pluckNumber)(r3dFactor,.15);_3dAttr={x:x,y:y,R1:R1,R2:R2,h:h,r3dFactor:r3dFactor,is2D:is2D,use3DLighting:use3DLighting,isHollow:isHollow,isFunnel:isFunnel,renderer:renderer};rect3D=normalizeShapes(existingGElement,_3dAttr)||renderer.group(gStr,graphicsGroup);rect3D.toFront();if((!rect3D.front&&!is2D||!(rect3D.funnel2D||rect3D.lighterHalf)&&is2D)&&datasetStore.getState("notInitial")&&datasetStore.config.prevIs2d===_3dAttr.is2D){Shapeargs2=getPyramid3DShapeArgs(_3dAttr);oldLastData.y=oldLastData.y+oldLastData.h;oldLastData.R1=oldLastData.R2;oldLastData.h=0;Shapeargs=getPyramid3DShapeArgs(oldLastData)}else{Shapeargs=getPyramid3DShapeArgs(_3dAttr);datasetStore.getState("notInitial",true)}squeezedShapeArgs=Object.assign({},_3dAttr);squeezedShapeArgs.y=squeezedShapeArgs.y+squeezedShapeArgs.h;squeezedShapeArgs.R1=squeezedShapeArgs.R2;squeezedShapeArgs.h=0;squeezedFormPathObj=getPyramid3DShapeArgs(squeezedShapeArgs);rect3D.squeezedFormPathObj=squeezedFormPathObj;rect3D.Shapeargs=Shapeargs2||Shapeargs;animOrDraw=animatePathIfPresent(datasetStore,rect3D,animationType);rect3D.shadowElement=animOrDraw("shadowElement",Shapeargs.silhuette,{fill:TRACKER_FILL,stroke:noneStr});rect3D._attr=rect3D._attr||rect3D.attr;rect3D.attr=attr;rect3D.shadow=_shadow;rect3D._3dAttr=_3dAttr;if(isFunnel){if(is2D){rect3D.funnel2D=animOrDraw("funnel2D",Shapeargs.silhuette);Shapeargs2&&(rect3D.funnel2D=animOrDraw("funnel2D",Shapeargs2.silhuette))}else{rect3D.back=animOrDraw("back",Shapeargs.back,{"stroke-width":0,stroke:noneStr});rect3D.front=animOrDraw("front",Shapeargs.front,{"stroke-width":0,stroke:noneStr});Shapeargs2&&(rect3D.back=animOrDraw("back",Shapeargs2.back,{"stroke-width":0,stroke:noneStr}));Shapeargs2&&(rect3D.front=animOrDraw("front",Shapeargs2.front,{"stroke-width":0,stroke:noneStr}));if(Shapeargs.top){rect3D.toptop=animOrDraw("toptop",Shapeargs.top,{"stroke-width":0,stroke:noneStr});Shapeargs2&&(rect3D.toptop=animOrDraw("toptop",Shapeargs2.top,{"stroke-width":0,stroke:noneStr}))}}}else{if(is2D){rect3D.lighterHalf=animOrDraw("lighterHalf",Shapeargs.lighterHalf,{"stroke-width":0});Shapeargs2&&(rect3D.lighterHalf=animOrDraw("lighterHalf",Shapeargs2.lighterHalf,{"stroke-width":0}));rect3D.darkerHalf=animOrDraw("darkerHalf",Shapeargs.darkerHalf,{"stroke-width":0});Shapeargs2&&(rect3D.darkerHalf=animOrDraw("darkerHalf",Shapeargs2.darkerHalf,{"stroke-width":0}));rect3D.borderElement=animOrDraw("borderElement",Shapeargs.silhuette,{fill:TRACKER_FILL,stroke:noneStr});Shapeargs2&&(rect3D.borderElement=animOrDraw("borderElement",Shapeargs2.silhuette,{fill:TRACKER_FILL,stroke:noneStr}))}else{rect3D.front=animOrDraw("front",Shapeargs.front,{"stroke-width":0});Shapeargs2&&(rect3D.front=animOrDraw("front",Shapeargs2.front,{"stroke-width":0}));rect3D.centerLight=animOrDraw("centerLight",Shapeargs.centerLight,{"stroke-width":0});Shapeargs2&&(rect3D.centerLight=animOrDraw("centerLight",Shapeargs2.centerLight,{"stroke-width":0}));rect3D.centerLight1=animOrDraw("centerLight1",Shapeargs.centerLight1,{"stroke-width":0});Shapeargs2&&(rect3D.centerLight1=animOrDraw("centerLight1",Shapeargs2.centerLight1,{"stroke-width":0}));rect3D.toptop=animOrDraw("toptop",Shapeargs.top,{"stroke-width":0});Shapeargs2&&(rect3D.toptop=animOrDraw("toptop",Shapeargs2.top,{"stroke-width":0}));rect3D.topLight=animOrDraw("topLight",Shapeargs.topLight,{"stroke-width":0});Shapeargs2&&(rect3D.topLight=animOrDraw("topLight",Shapeargs2.topLight,{"stroke-width":0}));rect3D.topLight1=animOrDraw("topLight1",Shapeargs.topLight1,{"stroke-width":0});Shapeargs2&&(rect3D.topLight1=animOrDraw("topLight1",Shapeargs2.topLight1,{"stroke-width":0}))}}return rect3D}}();_this.config.legendItemIds=[];var utils=_this.utils(_this),invokeHookFns=utils.invokeHookFns,postInitHookFn=_this.postInitHook;invokeHookFns(postInitHookFn);return _this}(0,_inheritsLoose2.default)(FunnelPyramidBaseDataset,_ComponentInterface);var _proto=FunnelPyramidBaseDataset.prototype;_proto.getType=function getType(){return"dataset"};_proto.getName=function getName(){return"funnelPyramidBase"};_proto.trimData=function trimData(datasetJSON){_pie2d.trimData.call(this,datasetJSON)};_proto.getDataLength=function getDataLength(){var dataset=this,i,data=dataset.getChildren("data"),dataLen=0,len=data.length;for(i=0;i<len;i++){if(!data[i].getState("removed")){dataLen++}}return dataLen};_proto.removeData=function removeData(indexArg,stretchArg,draw){if(draw===void 0){draw=false}var dataset=this,components=dataset.components,dataStore=dataset.getChildren("data"),removedDataArr,i,len,stretch=stretchArg,index=indexArg;stretch=(0,_lib.pluckNumber)(stretch,1);index=(0,_lib.pluckNumber)(index,0);removedDataArr=components.removedDataArr=dataStore.splice(index,stretch);len=removedDataArr.length;for(i=0;i<len;i++){if(!removedDataArr[i]){removedDataArr.splice(i,1)}}draw&&dataset.asyncDraw()};_proto.removePlots=function removePlots(){var dataset=this,components=dataset.components,removedDataArr=components.removedDataArr,i,elem,graphics,point;if(!removedDataArr){return}for(i=removedDataArr.length-1;i>=0;i--){point=removedDataArr[i];graphics=point.getGraphicalElement();for(elem in graphics){point.removeGraphicalElement(graphics[elem])}removedDataArr.splice(i,1)}};_proto._configure=function _configure(){var datasetStore=this,chart=datasetStore.getFromEnv("chart"),colorManager=datasetStore.getFromEnv("color-manager"),chartConfig=chart.config,globalStyle=chartConfig.style,datasetConf=datasetStore.config||{},jsonDataObj=datasetStore.config.JSONData,datasetDataArr=jsonDataObj.data||[],chartAttr=chart.getFromEnv("dataSource")?chart.getFromEnv("dataSource").chart:{},utils=datasetStore.utils(datasetStore),invokeHookFns=utils.invokeHookFns,copyProperties=utils.copyProperties,BLANK_SPACE=3,DEFAULT_LABEL_DISTANCE=50,DEFAULT_BLANK_SPACE=3,configureSpecificsFn=datasetStore.configureSpecifics,baseFontColor=colorManager.getColor("baseFontColor");copyProperties(chartAttr,datasetConf,[["showlabels","showLabels",_lib.pluckNumber,1],["showvalues","showValues",_lib.pluckNumber,1],["plottooltext","toolText",_lib.pluck,_lib.BLANK],["enableslicing","enableSlicing",_lib.pluckNumber,1],["plotfillalpha","plotFillAlpha",_lib.pluckNumber,100],["showplotborder","showPlotBorder",_lib.pluckNumber,0],["plotborderalpha","plotBorderAlpha",_lib.pluckNumber,UNDEF],["plotbordercolor","plotBorderColor",_lib.pluck,UNDEF],["plotborderthickness","plotBorderThickness",_lib.pluckNumber,1],["showshadow","showShadow",_lib.pluckNumber,1],["showhovereffect",showHoverEffectStr,_lib.pluckNumber,0],["hovercapsepchar","hoverCapSepChar",_lib.pluck,_lib.COMMASPACE],["tooltipsepchar","tooltipSepChar",_lib.pluck,"$hoverCapSepChar"],["labelsepchar","labelSepChar",function(){return(0,_lib.parseUnsafeString)(_lib.pluck.apply(void 0,arguments))},"$tooltipSepChar"],["showpercentintooltip","showPercentInToolTip",_lib.pluckNumber,1],["showpercentvalues","showPercentValues",_lib.pluckNumber,0],[_lib.BLANK,"blankSpace",_lib.pluckNumber,BLANK_SPACE],["labeldistance","labelDistance",_lib.pluckNumber,DEFAULT_LABEL_DISTANCE],["issliced","isSliced",_lib.pluckNumber,0],["is2d","is2d",_lib.pluckNumber,0],[_lib.BLANK,"blankSpace",_lib.pluckNumber,DEFAULT_BLANK_SPACE],["showlabelsatcenter","showLabelsAtCenter",_lib.pluckNumber,0],["smartlinethickness","connectorWidth",_lib.pluckNumber,1],["smartlinealpha","connectorAlpha",_lib.pluckNumber,100],["smartlinecolor","rawSmartLineColorCode",_lib.pluck,function(){return colorManager.getColor("baseFontColor")}],["labelalpha","labelAlpha",_lib.pluckNumber,100],["basefont","baseFont",_lib.pluck,"Verdana,sans"],["basefontsize","baseFontSize",_lib.pluckNumber,10],["basefontcolor","baseFontColor",_lib.pluck,baseFontColor],["labelfontcolor","labelFontColor",_lib.pluck,"$baseFontColor"],["showtooltip","showTooltip",_lib.pluckNumber,1],["percentofprevious","percentOfPrevious",_lib.pluckNumber,0],["animationduration","animationDuration",_lib.pluckNumber,1,function(datasetConfig){datasetConfig.animationDuration*=1e3}]]);datasetConf.usePattern=(0,_lib.pluckNumber)(chartConfig.usePattern,0);datasetConf.patternType=PATTERN_TYPES.includes(jsonDataObj.patterntype)?jsonDataObj.patterntype:chartConfig.patternType;datasetConf.patternDensity=(0,_lib.pluckNumber)(jsonDataObj.patterndensity,chartConfig.patternDensity);datasetConf.patternAlpha=(0,_lib.pluckNumber)(jsonDataObj.patternalpha,chartConfig.patternAlpha);datasetConf.patternBgColor=(0,_lib.pluck)(jsonDataObj.patternbgcolor,TRACKER_FILL);if(datasetConf.usePattern){datasetConf.is2d=1;datasetConf.showPlotBorder=(0,_lib.pluck)(chartAttr.showplotorder,1);datasetConf.showHoverEffect=0}datasetConf.connectorColor=(0,_lib.convertColor)(datasetConf.rawSmartLineColorCode,datasetConf.connectorAlpha);datasetConf.origLabelDistance=datasetConf.labelDistance;(0,_lib.setLineHeight)(globalStyle);globalStyle.nLineHeight=globalStyle.lineHeight.match(/^\d+/)[0];copyProperties(globalStyle,datasetConf,[[_lib.BLANK,"lineHeight",_lib.pluckNumber,datasetConf.baseFontSize]]);if(datasetConf.isSliced){datasetConf.clicked=true}delete globalStyle.nLineHeight;invokeHookFns(configureSpecificsFn);if(!datasetConf.showLabels&&!datasetConf.showValues){datasetConf.datalabelDisabled=true}else{datasetConf.datalabelDisabled=false}datasetStore.getNormalizeDataSet(datasetDataArr)};_proto._preDrawingHook=function _preDrawingHook(){var dataset=this,chart=dataset.getFromEnv("chart"),datasetConf=dataset.config,chartConf=chart.config,utils=dataset.utils(dataset),chartAttr=chart.getFromEnv("dataSource")?chart.getFromEnv("dataSource").chart:{},heightAllotted=chartConf.canvasHeight,copyProperties=utils.copyProperties;copyProperties(chartAttr,datasetConf,[[_lib.BLANK,"slicingDistance",_lib.pluckNumber,heightAllotted*.1],["slicingdistance","slicingHeight",_lib.pluckNumber,"$slicingDistance",function(){if(datasetConf.slicingHeight>2*datasetConf.slicingDistance){datasetConf.slicingDistance=0}else{datasetConf.slicingDistance=datasetConf.slicingHeight}}]])};_proto._checkValidData=function _checkValidData(data){var datasetDefStore=this,chart=datasetDefStore.getFromEnv("chart");if(!(data&&data.length)){chart.setChartMessage();return false}return true};_proto.addLegend=function addLegend(){var dataset=this,chart=dataset.getFromEnv("chart"),config,conf,tempId,legendItemIndex=0,chartAttr=chart.getFromEnv("dataSource").chart,i,dataObj,data=dataset.getChildren("data")||dataset.config.JSONData.data,legend=chart.getFromEnv("legend"),legendItem=legend.getChildren("legendItem");for(i=0;i<data.length;i++){dataObj=data[i];conf=dataObj.config;if(dataObj.pseudoPoint||dataObj.getState("removed")||!dataObj.label&&!dataObj.categoryLabel){if(dataObj.pseudoPoint){continue}typeof(dataObj.categoryLabel!=="undefined")&&legendItemIndex++;if(conf.legendItemId){legendItem=legend.getItem(conf.legendItemId);legendItem&&legend.disposeItem(legendItem.getId());delete conf.legendItemId}}else{config={type:dataset.getName(),label:dataObj.label||dataObj.categoryLabel,index:legendItemIndex,enabled:(0,_lib.pluckNumber)(chartAttr.includeinlegend,1),legendItemId:dataObj.legendItemId,usePattern:dataset.config.usePattern,legendIconAlpha:(0,_lib.pluckNumber)(data[i].legendiconalpha),patternAttr:dataObj.patternAttr};legendItem=legend.getItem(conf.legendItemId);if(!legendItem){tempId=legend.createItem(dataset);dataObj.config.legendItemId=tempId;legendItem=legend.getItem(conf.legendItemId);legendItem.addEventListener("fc-click",legendItem.itemClickFn)}legendItem.configure(config);legendItemIndex++;legendItem.setStateCosmetics("default",{symbol:{bgAlpha:(0,_lib.pluckNumber)(data[i].legendiconbgalpha,data[i].legendiconalpha,chartAttr.legendiconbgalpha,chartAttr.legendiconalpha,data[i].alpha),borderAlpha:(0,_lib.pluckNumber)(data[i].legendiconborderalpha,data[i].legendiconalpha,chartAttr.legendiconborderalpha,chartAttr.legendiconalpha,"100"),fill:data[i].legendColor,rawFillColor:data[i].rawColor,stroke:(0,_lib.getLightColor)(data[i].rawColor,60).replace(dropHash,_lib.HASHSTRING)}})}}};_proto.legendInteractivity=function legendInteractivity(legendItem){var plotItems=this.getChildren("data"),i,len,legendId=legendItem.getId();for(i=0,len=plotItems.length;i<len;i++){if(plotItems[i].config.legendItemId===legendId){this.legendClick({datasetStore:this,plotItem:plotItems[i].plot},true,false);break}}};_proto.getNormalizeDataSet=function getNormalizeDataSet(dataArr){var datasetStore=this,dsStore=datasetStore.getChildren("data")||[],chart=datasetStore.getFromEnv("chart"),conf=datasetStore.config,smartLabel=datasetStore.getFromEnv("smartLabel"),Point=conf.pointInContext,index,dataObj,refreshedData,hasValidPoint,sumValue=0,refreshedDataLength,chartAttr=chart.getFromEnv("dataSource").chart,defStyle,dataConnectorStyle=conf.dataConnectorStyle={},colorIndexStart=chart.config.PLOT_COLOR_INDEX_START,res,counter=0,point,notStreamlinedFunnel=0;(0,_lib.extend2)(defStyle=conf.style={},chart.config.style);conf.noOFSlicedElement=0;defStyle.borderDash=noneStr;defStyle.borderPadding=2;defStyle.borderRadius=0;defStyle.borderThickness=1;defStyle.color=(0,_lib.convertColor)(conf.labelFontColor,conf.labelAlpha);defStyle.fontFamily=conf.baseFont;defStyle.fontSize=conf.baseFontSize+PXSTRING;defStyle.fontSizeWithUnit=conf.baseFontSize+PXSTRING;defStyle.fontStyle=NORMALSTRING;defStyle.fontWeight=NORMALSTRING;dataConnectorStyle.connectorWidth=conf.connectorWidth;dataConnectorStyle.connectorColor=conf.connectorColor;res=datasetStore.datasetCalculations(dataArr);hasValidPoint=res.hasValidPoint;refreshedData=res.refreshedData;sumValue=res.sumValue;notStreamlinedFunnel=+(!conf.streamLinedData&&datasetStore.getName()==="funnel");datasetStore._chartLevelAttr=_lib.parsexAxisStyles.apply(this,[{},{},chartAttr,defStyle]);if(hasValidPoint){conf.sumValue=sumValue;refreshedDataLength=refreshedData.length;(0,_lib.componentFactory)(datasetStore,Point,"data",refreshedDataLength+notStreamlinedFunnel);dsStore=datasetStore.getChildren("data");smartLabel.useEllipsesOnOverflow(chart.config.useEllipsesWhenOverflow);for(index=0,counter=notStreamlinedFunnel;index<refreshedDataLength;index+=1,counter+=1){dataObj=refreshedData[index];point=dsStore[counter];if(point.getState("removed")){continue}point.parseAndConfigurePoint(dataObj,res,colorIndexStart++,index)}}if(notStreamlinedFunnel&&dsStore[0]){dsStore[0].configure({displayValue:_lib.BLANK,y:conf.sumValue,index:0})}};_proto.datasetCalculations=function datasetCalculations(dataArr){var datasetStore=this,numberFormatter=datasetStore.getFromEnv("number-formatter"),index,length,dataObj,itemValue,res={};res.refreshedData=[];res.sumValue=res.countPoint=0;res.highestValue=Number.NEGATIVE_INFINITY;for(index=0,length=dataArr.length;index<length;index++){dataObj=dataArr[index];if(dataObj.vline){continue}dataObj.cleanValue=itemValue=Math.abs(numberFormatter.getCleanValue(dataObj.value,true));if(itemValue!==null){res.hasValidPoint=true;res.highestValue=res.highestValue||itemValue;res.refreshedData.push(dataObj);res.sumValue+=itemValue;res.countPoint+=1;res.highestValue=Math.max(res.highestValue,res.itemValue)}}return res};_proto.pointHoverOptions=function pointHoverOptions(dataObj,pointCosmetics){var datasetStore=this,conf=datasetStore.config,chart=datasetStore.getFromEnv("chart"),hoverEffect=conf.usePattern?0:(0,_lib.pluckNumber)(dataObj.showhovereffect,conf.showHoverEffect),hoverEffects={enabled:hoverEffect},rolloverProperties={},highlightColors,colorLen,index,chartAttr=chart.getFromEnv("dataSource")?chart.getFromEnv("dataSource").chart:{};if(!hoverEffect&&!conf.usePattern){hoverEffect=hoverEffects.enabled=(0,_lib.pluck)(dataObj.hovercolor,chartAttr.plotfillhovercolor,dataObj.hoveralpha,chartAttr.plotfillhoveralpha,dataObj.borderhovercolor,chartAttr.plotborderhovercolor,dataObj.borderhoverthickness,chartAttr.plotborderhoverthickness,dataObj.borderhoveralpha,chartAttr.plotborderhoveralpha)!==UNDEF}if(hoverEffect){hoverEffects.highlight=(0,_lib.pluckNumber)(dataObj.highlightonhover,chartAttr.highlightonhover);hoverEffects.color=(0,_lib.pluck)(dataObj.hovercolor,chartAttr.plotfillhovercolor);hoverEffects.alpha=(0,_lib.pluck)(dataObj.hoveralpha,chartAttr.plotfillhoveralpha,pointCosmetics.alpha);hoverEffects.borderColor=(0,_lib.pluck)(dataObj.borderhovercolor,chartAttr.plotborderhovercolor,pointCosmetics.borderColor);hoverEffects.borderThickness=(0,_lib.pluckNumber)(dataObj.borderhoverthickness,chartAttr.plotborderhoverthickness,pointCosmetics.borderWidth);hoverEffects.borderAlpha=(0,_lib.pluck)(dataObj.borderhoveralpha,chartAttr.plotborderhoveralpha,pointCosmetics.borderAlpha);if(hoverEffects.highlight!==0&&hoverEffects.color===UNDEF){hoverEffects.highlight=1}hoverEffects.color=(0,_lib.pluck)(hoverEffects.color,pointCosmetics.color).replace(/,+?$/,_lib.BLANK);if(hoverEffects.highlight===1){highlightColors=hoverEffects.color.split(/\s{0,},\s{0,}/);colorLen=highlightColors.length;for(index=0;index<colorLen;index+=1){highlightColors[index]=(0,_lib.getLightColor)(highlightColors[index],70)}hoverEffects.color=highlightColors.join(",")}rolloverProperties={color:hoverEffects.color,alpha:+hoverEffects.alpha,borderColor:(0,_lib.convertColor)(hoverEffects.borderColor,hoverEffects.borderAlpha),rawBorderColor:hoverEffects.borderColor,borderAlpha:hoverEffects.borderAlpha,borderWidth:hoverEffects.borderThickness}}return{enabled:hoverEffect,options:hoverEffects,rolloverOptions:rolloverProperties}};_proto.getTooltipMacroStub=function getTooltipMacroStub(options){return _getTooltipMacroStub.call(this,options)};_proto.allocatePosition=function allocatePosition(){var dataset=this,chart=dataset.getFromEnv("chart"),chartConfig=chart.config,dsConfig=dataset.config;chartConfig.style.fontSize=this.computeFontSize(chartConfig.style.fontSizeWithUnit);dsConfig.lineHeight=dsConfig.lineHeight===0?0:parseInt(dataset._chartLevelAttr.lineHeight,10);if(!dsConfig.showLabelsAtCenter&&(dsConfig.labelSepChar==="<br>"||dsConfig.labelSepChar==="<br/>")){dsConfig.lineHeight=dsConfig.lineHeight*2}dataset._preDrawingHook();if(!dsConfig.sumValue){return}dsConfig.labelDrawingConfig=dsConfig.labelDrawingConfig||[];dsConfig.labelDrawingConfig.length=0;dsConfig.psmMargin={top:chartConfig.marginTop,bottom:chartConfig.marginBottom};dataset.preDrawingSpaceManagement()};_proto.preDrawingSpaceManagement=function preDrawingSpaceManagement(){var datasetStore=this,chart=datasetStore.getFromEnv("chart"),chartConf=chart.config,caption=chart.getChildren("caption")[0],subCaption=chart.getChildren("subCaption")[0],capHeight=caption.config.height||0,subCapHeight=subCaption.config.height||0,conf=datasetStore.config,showTooltip=conf.showTooltip,slicingDistance=conf.slicingDistance,canvasHeight,canvasMaxWidth,chartWorkingHeight=chartConf.height-(chartConf.marginTop+chartConf.marginBottom),chartWorkingWidth=chartConf.width-(chartConf.marginRight+chartConf.marginLeft),dataArr=datasetStore.getChildren("data"),length,labelDistance,showLabelsAtCenter,blankSpace=conf.blankSpace,i=datasetStore.config.LABEL_PLACEMENT_ITERATOR_INDEX_START,upperRadiusFactor=datasetStore.getName()==="funnel"?1:0,minWidthForChart,drawingWillExtend,maxWidthForLabel,labelMaxUsedWidth,hasPoint,maxValue,valueRadiusIncrementRatio,smartLabel=datasetStore.getFromEnv("smartLabel"),totalValue,point,lineHeight,smartTextObj,chartDrawingWidth,currentValue,ratioK,currentDiameter,labelMaxWidth,extraSpace,newDiameter=0,lowestRadiusFactor,labelMaxW=0,tempSnap,labelOverlappingW,utils=datasetStore.utils(datasetStore),gutter=5,snapOffset,invokeHookFns=utils.invokeHookFns,labelStyle,prePointProcessingHookFn=datasetStore.prePointProcessingHookFn,legend=chart.getFromEnv("legend"),legendPos=chartConf.showLegend&&legend&&legend.config&&legend.config.legendPos?legend.config.legendPos.split("-"):[],legendWidth=0;if(chartConf.showLegend&&(legendPos[0]==="right"||legendPos[0]==="left")){legendWidth=legend.config.width+2*gutter}chartConf.oriCanvasLeft=chart.config.canvasLeft;chartConf.oriBottomSpace=chart.config.marginBottom;chartConf.oriTopSpace=chart.config.marginTop;tempSnap=conf._tempSnap={top3DSpace:0,bottom3DSpace:0,topLabelSpace:0,rightLabelSpace:0};canvasHeight=chartWorkingHeight-slicingDistance;canvasMaxWidth=Math.min(2*canvasHeight,chartWorkingWidth);chartConf.marginTop+=slicingDistance/2;chartConf.marginBottom+=slicingDistance/2;length=datasetStore.getDataLength();labelDistance=conf.origLabelDistance+blankSpace;showLabelsAtCenter=conf.showLabelsAtCenter;minWidthForChart=Math.min(canvasMaxWidth,chartWorkingWidth*.3);drawingWillExtend=chartWorkingWidth-minWidthForChart;chartWorkingWidth-=legendWidth;maxWidthForLabel=chartWorkingWidth/2-minWidthForChart/2-labelDistance-chartConf.marginLeft;labelMaxUsedWidth=0;hasPoint=dataArr[0];maxValue=hasPoint&&dataArr[0].y?dataArr[0].y:1;valueRadiusIncrementRatio=.8/maxValue;invokeHookFns(prePointProcessingHookFn,[dataArr]);totalValue=conf.totalValue||0;smartLabel.useEllipsesOnOverflow(chartConf.useEllipsesWhenOverflow);for(;i<length;i+=1){point=dataArr[i];if(point.legendItemId){legend.configureItems&&legend.configureItems(point.legendItemId,{configuration:{fillColor:point.legendColor}})}labelStyle=point.style;(0,_lib.setLineHeight)(labelStyle);lineHeight=(0,_lib.pluckNumber)(mathCeil(parseFloat(labelStyle.lineHeight)+labelStyle.borderPadding+labelStyle.borderThickness+gutter),10);smartLabel.setStyle(labelStyle);currentValue=point.y;if(showLabelsAtCenter){smartTextObj=smartLabel.getSmartText(point.origValue,chartWorkingWidth,lineHeight)}else{currentValue=point.getModifiedCurrentValue&&point.getModifiedCurrentValue(totalValue)||currentValue;ratioK=point.getRatioK(datasetStore,currentValue,valueRadiusIncrementRatio,totalValue,maxValue);currentDiameter=minWidthForChart*ratioK;labelMaxWidth=maxWidthForLabel+(minWidthForChart-currentDiameter)/2;if(conf.labelSepChar==="<br>"||conf.labelSepChar==="<br/>"){lineHeight=lineHeight*2}smartTextObj=smartLabel.getSmartText(point.origValue,labelMaxWidth,lineHeight);point.displayValue=smartTextObj.text;showTooltip&&smartTextObj.tooltext&&(point.originalText=smartTextObj.tooltext);labelMaxUsedWidth=Math.max(labelMaxUsedWidth,smartTextObj.width);if(drawingWillExtend>0){if(smartTextObj.width>0){extraSpace=labelMaxWidth-smartTextObj.width}else{extraSpace=labelMaxWidth+labelDistance}newDiameter=1/(ratioK+1)*(currentDiameter+2*extraSpace+minWidthForChart);drawingWillExtend=Math.min(drawingWillExtend,newDiameter-minWidthForChart)}totalValue+=conf.offsetVal===UNDEF?point.y:typeof conf.offsetVal==="function"?conf.offsetVal(i):conf.offsetVal}}if(chartConf.showLegend&&(legendPos[0]==="right"||legendPos[0]==="left")){chart.isLegendRight=true;chartConf.marginRight+=legendWidth}else{chart.isLegendRight=false}if(point){lowestRadiusFactor=point.getLowestRadiusFactor(datasetStore,maxValue)}chartDrawingWidth=minWidthForChart+drawingWillExtend;if(chartDrawingWidth>canvasMaxWidth){chartDrawingWidth=canvasMaxWidth}totalValue=conf.offsetVal===UNDEF?0:typeof conf.offsetVal==="function"?conf.offsetVal():conf.offsetVal;if(!showLabelsAtCenter){i=datasetStore.config.LABEL_PLACEMENT_ITERATOR_INDEX_START;for(length=datasetStore.getDataLength();i<length;i+=1){point=dataArr[i];currentValue=point.y;currentValue=point.getModifiedCurrentValue&&point.getModifiedCurrentValue(totalValue)||currentValue;ratioK=point.getRatioK(datasetStore,currentValue,valueRadiusIncrementRatio,totalValue,maxValue);currentDiameter=chartDrawingWidth*ratioK;labelMaxWidth=maxWidthForLabel+(minWidthForChart-currentDiameter)/2-legendWidth;smartTextObj=smartLabel.getSmartText(point.displayValue,labelMaxWidth,lineHeight);labelMaxW=mathMax(labelMaxW,currentDiameter*.5+smartTextObj.width+labelDistance);totalValue+=conf.offsetVal===UNDEF?point.y:typeof conf.offsetVal==="function"?conf.offsetVal():conf.offsetVal}}if(labelMaxUsedWidth>0){tempSnap.rightLabelSpace=chartWorkingWidth-chartDrawingWidth;labelOverlappingW=labelMaxW-chartConf.canvasWidth*.5;if(labelOverlappingW>0){chartConf.marginRight+=labelOverlappingW;chartConf.marginLeft-=labelOverlappingW}chartConf.marginRight+=tempSnap.rightLabelSpace*.5;chartConf.marginLeft+=tempSnap.rightLabelSpace*.5}else{labelDistance=0}conf.labelDistance=conf.connectorWidth=labelDistance;if((showLabelsAtCenter||!labelMaxUsedWidth)&&canvasMaxWidth<chartWorkingWidth){chartConf.marginLeft+=(chartWorkingWidth-canvasMaxWidth-labelDistance)*.5;chartConf.marginRight+=(chartWorkingWidth-canvasMaxWidth-labelDistance)*.5}if(!conf.is2d){chartConf.marginTop+=tempSnap.top3DSpace=chartDrawingWidth*conf.yScale*upperRadiusFactor/2;chartConf.marginBottom+=tempSnap.bottom3DSpace=chartDrawingWidth*conf.yScale*lowestRadiusFactor/2}datasetStore.calculatePositionOfPlots();snapOffset=capHeight+subCapHeight+gutter;if(datasetStore.getName()==="funnel"){if(conf.streamLinedData&&dataArr.length<2){chartConf.gaugeStartX=chartConf.marginLeft;chartConf.gaugeStartY=chartConf.marginTop+snapOffset;chartConf.gaugeEndX=chartDrawingWidth+chartConf.marginLeft;chartConf.gaugeEndY=chartConf.canvasHeight+chartConf.marginTop}else{chartConf.gaugeStartX=dataArr[0].plotX-dataArr[1].shapeArgs.R1;chartConf.gaugeEndX=dataArr[0].plotX+dataArr[1].shapeArgs.R1;chartConf.gaugeStartY=dataArr[0].plotY;chartConf.gaugeEndY=dataArr[length-1].plotY}}else{chartConf.gaugeStartX=dataArr[length-1].plotX-dataArr[length-1].shapeArgs.R2;chartConf.gaugeEndX=dataArr[length-1].plotX+dataArr[length-1].shapeArgs.R2;chartConf.gaugeStartY=dataArr[0].shapeArgs.y;chartConf.gaugeEndY=dataArr[length-1].shapeArgs.y+dataArr[length-1].shapeArgs.h}chartConf.gaugeCenterX=chartConf.canvasCenterX=(chartConf.gaugeStartX+chartConf.gaugeEndX)/2;chartConf.gaugeCenterY=(chartConf.gaugeStartY+chartConf.gaugeEndY)/2;chartConf.plotSemiWidth=(chartConf.canvasWidth-tempSnap.rightLabelSpace)/2};_proto.animateElements=function animateElements(elements,subElem,subElemKeys,conditions){if(subElemKeys===void 0){subElemKeys=[]}var datasetStore=this,target,index,length,ele,i,l;function animate(_t,point){var ialpha=(point||{}).alpha;ialpha=ialpha===UNDEF?conditions.post:{opacity:ialpha};if(!_t){return}datasetStore.getFromEnv("animationManager").setAnimation({el:_t,attr:ialpha,component:datasetStore})}for(index=0,length=elements.length;index<length;index++){ele=elements[index];if(!ele){continue}if(!subElemKeys.length){target=ele;animate(target[subElem],ele.point)}else{for(i=0,l=subElemKeys.length;i<l;i++){target=elements[index][su