@fusioncharts/charts
Version:
JavaScript Data Visualisation Library
1 lines • 24.5 kB
JavaScript
;var _interopRequireDefault=require("@babel/runtime/helpers/interopRequireDefault");exports.__esModule=true;exports.default=void 0;var _inheritsLoose2=_interopRequireDefault(require("@babel/runtime/helpers/inheritsLoose"));var _line=_interopRequireDefault(require("../line"));var _lib=require("@fusioncharts/core/src/lib");var _dependencyManager=require("@fusioncharts/core/src/dependency-manager");var _kdtree=_interopRequireDefault(require("../_internal/kdtree"));var _index=_interopRequireDefault(require("./index.animation"));var _isNil=_interopRequireDefault(require("ramda/src/isNil"));var math=Math,mathMax=math.max,mathMin=math.min,mathRound=math.round;var UNDEF,COMMA=",",NONE="none",COMMASTRING=",",PLOTGRADIENTCOLOR="plotGradientColor",SHOWSHADOW="showShadow",getPointColor=function getPointColor(clr,alph){var colorObj,innerColor,outerColor,color=clr,alpha=alph;color=(0,_lib.getFirstColor)(color);alpha=(0,_lib.getFirstAlpha)(alpha);innerColor=(0,_lib.getLightColor)(color,70);outerColor=(0,_lib.getDarkColor)(color,50);colorObj={FCcolor:{gradientUnits:"objectBoundingBox",cx:.4,cy:.4,r:"100%",color:innerColor+COMMASTRING+outerColor,alpha:alpha+COMMASTRING+alpha,ratio:_lib.BGRATIOSTRING,radialGradient:true}};return colorObj};(0,_dependencyManager.addDep)({name:"scatterAnimation",type:"animationRule",extension:_index.default});var ScatterDataset=function(_LineDataset){function ScatterDataset(){return _LineDataset.apply(this,arguments)||this}(0,_inheritsLoose2.default)(ScatterDataset,_LineDataset);var _proto=ScatterDataset.prototype;_proto.getType=function getType(){return"dataset"};_proto.setupHoverTracker=function setupHoverTracker(){var dataset=this,searchDataArr=dataset.config.searchDataArr=[],dsComponents=dataset.components,dataStore=dsComponents.data,anchorProps={},i,j,ii,xPos,yPos,dataObj,plotConfig,skippingInfo=dataset.getSkippingInfo&&dataset.getSkippingInfo(),plotDrawArray=skippingInfo&&skippingInfo.draw||[],plotDrawArrayLength=plotDrawArray.length,skippingApplied=skippingInfo&&skippingInfo.skippingApplied;ii=dataStore.length;if(skippingApplied){ii=plotDrawArrayLength}for(j=0;j<ii;j++){i=plotDrawArray[j]||[j];dataObj=dataStore[i];if(dataObj){plotConfig=dataObj.config;xPos=plotConfig._Px;yPos=plotConfig._Py;anchorProps=plotConfig.anchorProps;searchDataArr.push({x:xPos,y:yPos,index:i,data:dataObj,r:anchorProps.radius||0})}}this.config.dataTree=(new _kdtree.default).buildKdTree(searchDataArr)};_proto.getName=function getName(){return"scatter"};_proto.addDatasetSpecificEvtArgs=function addDatasetSpecificEvtArgs(_dataObj){var dataObj=_dataObj,plotConfig=dataObj.config,anchorProps=plotConfig.anchorProps,eventArgs=plotConfig.eventArgs;Object.assign(eventArgs,{showValue:plotConfig.showValue,hoverColor:plotConfig.hoverEffects.enabled===true?plotConfig.hoverEffects.hoverColor||anchorProps.bgColor:UNDEF,hoverAlpha:plotConfig.hoverEffects.enabled===true?plotConfig.hoverEffects.hoverAlpha||"100":UNDEF,anchorBgColor:anchorProps.bgColor,anchorBgAlpha:anchorProps.anchorBgAlpha,anchorAlpha:anchorProps.anchorAlpha,anchorBorderColor:anchorProps.borderColor,anchorBorderThickness:anchorProps.borderThickness,anchorRadius:anchorProps.radius,anchorSides:anchorProps.sides,anchorStartAngle:anchorProps.startAngle,anchorHoverSides:plotConfig.hoverEffects.anchorSides})};_proto.configureAttributes=function configureAttributes(datasetJSON){if(!datasetJSON){return false}this.trimData(datasetJSON);this.config.JSONData=datasetJSON;var plotBorderDash,parentYAxis,enableAnimation,defaultShadow,dataSet=this,chart=dataSet.getFromEnv("chart"),conf=dataSet.config,JSONData=conf.JSONData,areaAlpha=chart.areaAlpha,chartAttr=chart.getFromEnv("dataSource").chart,colorM=dataSet.getFromEnv("color-manager"),showplotborder=(0,_lib.pluckNumber)(JSONData.showplotborder,chartAttr.showplotborder||1),plotFillColor=colorM.getPlotColor(dataSet.index),usePlotGradientColor,lineDashed=conf.lineDashed=(0,_lib.pluckNumber)(JSONData.linedashed,JSONData.dashed,chartAttr.linedashed,0),isLineSet=dataSet.isLineSet;conf.plotColor=plotFillColor;defaultShadow=(0,_lib.pluckNumber)(chart.defaultPlotShadow,colorM.getColor(SHOWSHADOW));conf.toolTipSepChar=(0,_lib.pluck)(chartAttr.tooltipsepchar,", ");conf.legendFillColor=(0,_lib.pluck)(chartAttr.legendfillcolor,1);conf.defaultValuePadding={left:0,right:0};if(isLineSet){conf.parentYAxis=parentYAxis=1}else{conf.parentYAxis=parentYAxis=(0,_lib.pluck)(JSONData.parentyaxis&&JSONData.parentyaxis.toLowerCase(),"p")==="s"?1:0}dataSet.config.yAxis=dataSet.getFromEnv("yAxis")[parentYAxis];conf.connectNullData=(0,_lib.pluckNumber)(chartAttr.connectnulldata,0);conf.seriesname=(0,_lib.parseUnsafeString)(JSONData.seriesname);conf.includeinlegend=(0,_lib.pluckNumber)(JSONData.includeinlegend,conf.seriesname?1:0);conf.showTextOutline=(0,_lib.pluckNumber)(chartAttr.textoutline,0);conf.enableAnimation=enableAnimation=(0,_lib.pluckNumber)(chartAttr.animation,chartAttr.defaultanimation,1);conf.animation=!enableAnimation?false:{duration:(0,_lib.pluckNumber)(chartAttr.animationduration,1)*1e3};conf.transposeanimation=(0,_lib.pluckNumber)(chartAttr.transposeanimation,enableAnimation);conf.transposeanimduration=(0,_lib.pluckNumber)(chartAttr.transposeanimduration,.2)*1e3;conf.showvalues=(0,_lib.pluckNumber)(JSONData.showvalues,chartAttr.showvalues);conf.valuePadding=(0,_lib.pluckNumber)(chartAttr.valuepadding,2);conf.valuePosition=(0,_lib.pluck)(JSONData.valueposition,chartAttr.valueposition,"auto");conf.showTooltip=(0,_lib.pluckNumber)(chartAttr.showtooltip,1);conf.seriesNameInTooltip=(0,_lib.pluckNumber)(chartAttr.seriesnameintooltip,1);conf.plotFillColor=conf.plotfillcolor=(0,_lib.pluck)(JSONData.color,chartAttr.plotfillcolor,plotFillColor);conf.plotFillAngle=conf.plotFillAngle=(0,_lib.pluck)(chartAttr.plotfillangle,270);conf.plotFillAlpha=conf.plotfillalpha=(0,_lib.pluck)(JSONData.alpha,chartAttr.plotfillalpha,areaAlpha,"100");usePlotGradientColor=(0,_lib.pluckNumber)(chartAttr.useplotgradientcolor,1);conf.plotGradientColor=conf.plotgradientcolor=usePlotGradientColor!==0?(0,_lib.getDefinedColor)(chartAttr.plotgradientcolor,colorM.getColor(PLOTGRADIENTCOLOR)):"";conf.fillColor=conf.fillcolor={color:conf.plotfillcolor+(conf.plotgradientcolor?COMMA+conf.plotgradientcolor:_lib.BLANKSTRING),alpha:conf.plotfillalpha,angle:conf.plotFillAngle};conf.plotBorderAlpha=conf.plotborderalpha=showplotborder?(0,_lib.pluck)(JSONData.plotborderalpha,chartAttr.plotborderalpha,JSONData.alpha,"95"):0;conf.plotBorderColor=conf.plotbordercolor=(0,_lib.pluck)(JSONData.plotbordercolor,chartAttr.plotbordercolor,chartAttr.areabordercolor,"666666");conf.dashed=plotBorderDash=(0,_lib.pluckNumber)(JSONData.dashed,chartAttr.plotborderdashed);conf.plotBorderDashLen=conf.plotborderdashlen=(0,_lib.pluck)(JSONData.plotborderdashlen,chartAttr.plotborderdashlen,5);conf.plotBorderDashGap=conf.plotborderdashgap=(0,_lib.pluck)(JSONData.plotborderdashgap,chartAttr.plotborderdashgap,4);conf.plotBorderThickness=conf.plotborderthickness=(0,_lib.pluckNumber)(JSONData.plotborderthickness,chartAttr.plotborderthickness,1);conf.plotBorderDashStyle=conf.plotborderdashstyle=plotBorderDash?(0,_lib.getDashStyle)(conf.plotborderdashlen,conf.plotborderdashgap):"none";conf.showHoverEffect=conf.showhovereffect=(0,_lib.pluckNumber)(chartAttr.plothovereffect,chartAttr.anchorhovereffect,chartAttr.showhovereffect,UNDEF);conf.rotateValues=(0,_lib.pluckNumber)(chartAttr.rotatevalues)?270:0;conf.drawLine=(0,_lib.pluckNumber)(JSONData.drawline,chartAttr.drawlines,0);conf.lineThickness=conf.linethickness=(0,_lib.pluckNumber)(JSONData.linethickness,chartAttr.linethickness,2);conf.lineDashLen=conf.linedashlen=(0,_lib.pluckNumber)(JSONData.linedashlen,chartAttr.linedashlen,5);conf.lineDashGap=conf.linedashgap=(0,_lib.pluckNumber)(JSONData.linedashgap,chartAttr.linedashgap,4);conf.lineAlpha=conf.linealpha=(0,_lib.pluckNumber)(JSONData.linealpha,chartAttr.linealpha,JSONData.alpha,_lib.HUNDREDSTRING);conf.lineColor=conf.linecolor=(0,_lib.pluck)(JSONData.linecolor,chartAttr.linecolor,JSONData.color,conf.plotColor);conf.lineDashStyle=conf.linedashstyle=(0,_lib.getDashStyle)(conf.linedashlen,conf.linedashgap);conf.lineDashStyle=conf.linedashstyle=lineDashed?conf.linedashstyle:NONE;conf.shadow={opacity:(0,_lib.pluckNumber)(chartAttr.showshadow,defaultShadow)?conf.linealpha/100:0};conf.drawanchors=(0,_lib.pluckNumber)(JSONData.drawanchors,JSONData.showanchors,chartAttr.drawanchors,chartAttr.showanchors);conf.anchorbgcolor=(0,_lib.getFirstColor)((0,_lib.pluck)(JSONData.anchorbgcolor,chartAttr.anchorbgcolor,colorM.getColor("anchorBgColor")));conf.anchorbordercolor=(0,_lib.getFirstColor)((0,_lib.pluck)(JSONData.anchorbordercolor,JSONData.color,chartAttr.anchorbordercolor,conf.linecolor));conf.anchorradius=(0,_lib.pluckNumber)(JSONData.anchorradius,chartAttr.anchorradius,3);conf.anchoralpha=(0,_lib.pluck)(JSONData.anchoralpha,JSONData.alpha,chartAttr.anchoralpha,_lib.HUNDREDSTRING);conf.anchorbgalpha=(0,_lib.pluck)(JSONData.anchorbgalpha,JSONData.alpha,chartAttr.anchorbgalpha,_lib.HUNDREDSTRING);conf.anchorborderthickness=(0,_lib.pluck)(JSONData.anchorborderthickness,chartAttr.anchorborderthickness,1);conf.anchorsides=(0,_lib.pluckNumber)(JSONData.anchorsides,chartAttr.anchorsides,conf.index+3);conf.anchorimageurl=(0,_lib.pluck)(JSONData.anchorimageurl,chartAttr.anchorimageurl);conf.anchorimagealpha=(0,_lib.pluckNumber)(JSONData.anchorimagealpha,chartAttr.anchorimagealpha,100);conf.anchorimagescale=(0,_lib.pluckNumber)(JSONData.anchorimagescale,chartAttr.anchorimagescale,100);conf.anchorimagepadding=(0,_lib.pluckNumber)(JSONData.anchorimagepadding,chartAttr.anchorimagepadding,1);conf.anchorstartangle=(0,_lib.pluckNumber)(JSONData.anchorstartangle,chartAttr.anchorstartangle,90);conf.anchorshadow=(0,_lib.pluckNumber)(JSONData.anchorshadow,chartAttr.anchorshadow,0);conf.plotToolText=(0,_lib.getValidValue)((0,_lib.parseUnsafeString)((0,_lib.pluck)(JSONData.plottooltext,chartAttr.plottooltext),false));dataSet.setState("visible",(0,_lib.pluckNumber)(JSONData.visible,!Number(JSONData.initiallyhidden),1)===1);dataSet._setConfigure();chart.config.hasLegend!==false&&chart.config.showLegend&&dataSet._addLegend();dataSet.setState("dirty",true)};_proto.calculateScrollRange=function calculateScrollRange(){var dataSet=this,dsConfig=dataSet.config,chart=dataSet.getFromEnv("chart"),xAxis=dataSet.getFromEnv("xAxis"),hasScroll=chart.hasScroll,dataStore=dataSet.components.data,dsLen=dataStore.length;dsConfig.scrollMinVal=hasScroll?mathMax(mathRound(xAxis.getVisibleConfig().minValue)-1,0):0;dsConfig.scrollMaxVal=hasScroll?mathMin(mathRound(xAxis.getVisibleConfig().maxValue)+2,dsLen):dsLen;dsConfig.scrollMinValForLabel=dsConfig.scrollMinVal;dsConfig.scrollMaxValForLabel=dsConfig.scrollMaxVal};_proto._setConfigure=function _setConfigure(){var i,config,dataObj,setData,setValue,toolText,toolTipValue,macroIndices,parserConfig,formatedVal,formatedValX,setDisplayValue,infMin=-Infinity,infMax=+Infinity,yMax=infMin,yMin=infMax,xMin=infMax,xMax=infMin,dataSet=this,dataStore=dataSet.components.data||(dataSet.components.data=[]),chart=dataSet.getFromEnv("chart"),conf=dataSet.config,JSONData=conf.JSONData,chartAttr=chart.getFromEnv("dataSource").chart,setDataArr=JSONData.data||[],dataSetLen=setDataArr.length,numberFormatter=dataSet.getFromEnv("number-formatter"),yAxisName=(0,_lib.parseUnsafeString)(chartAttr.yaxisname),xAxisName=(0,_lib.parseUnsafeString)(chartAttr.xaxisname),lineDashed=conf.lineDashed,lineDashStyle=conf.linedashstyle,parentYAxis=conf.parentYAxis,tooltipSepChar=conf.toolTipSepChar,seriesname=conf.seriesname;conf.imageCount=0;for(i=0;i<dataSetLen;i+=1){setData=setDataArr[i];dataObj=dataStore[i]||(dataStore[i]={});config=dataObj.config||(dataObj.config={});config.setValue=setValue={x:numberFormatter.getCleanValue(setData.x),y:numberFormatter.getCleanValue(setData.y)};if(setValue.x!==null&&setValue.y!==null){if(setValue.x>xMax){xMax=setValue.x;conf.rightMostData=dataObj}if(setValue.x<xMin){xMin=setValue.x;conf.leftMostData=dataObj}if(setValue.y>yMax){yMax=setValue.y;conf.topMostData=dataObj}if(setValue.y<yMin){yMin=setValue.y;conf.bottomMostData=dataObj}}config._x=setValue.x;config._y=setValue.y;config.dataLabelStyle=dataSet._configureDataLabelStyle(setData);config.setLink=(0,_lib.pluck)(setData.link);config.anchorProps=this._parseAnchorProperties(i);config.showValue=(0,_lib.pluckNumber)(setData.showvalue,conf.showvalues);config.dashed=(0,_lib.pluckNumber)(setData.dashed,lineDashed);config.color=(0,_lib.pluck)(setData.color,conf.linecolor);config.alpha=(0,_lib.pluck)(setData.alpha,conf.linealpha);config.valuePadding=(0,_lib.pluckNumber)(setData.valuepadding,JSONData.valuepadding,chart.config.valuepadding);config.dashStyle=config.dashed?lineDashStyle:"none";config.toolTipValue=toolTipValue=numberFormatter.dataLabels(setValue.y,parentYAxis);config.setDisplayValue=setDisplayValue=(0,_lib.parseUnsafeString)(setData.displayvalue);formatedVal=config.formatedVal=(0,_lib.pluck)(setData.toolTipValue,numberFormatter.dataLabels(setValue.y,parentYAxis));formatedValX=numberFormatter.xAxis(setValue.x);config.displayValue=(0,_lib.pluck)(setDisplayValue,toolTipValue);config.setTooltext=(0,_lib.getValidValue)((0,_lib.parseUnsafeString)((0,_lib.pluck)(setData.tooltext,conf.plotToolText),false));if(!conf.showTooltip){toolText=false}else if(config.setTooltext!==UNDEF){macroIndices=[4,5,6,7,8,9,10,11];parserConfig={yaxisName:yAxisName,xaxisName:xAxisName,yDataValue:formatedVal,xDataValue:formatedValX};toolText=(0,_lib.parseTooltext)(config.setTooltext,macroIndices,parserConfig,setData,chartAttr,JSONData)}else{if(formatedVal===null){toolText=false}else{toolText=seriesname?seriesname+tooltipSepChar:_lib.BLANKSTRING;if((0,_isNil.default)(setValue.x)){toolText+=_lib.BLANKSTRING}else{toolText+=formatedValX+tooltipSepChar}toolText+=toolTipValue}}config.toolText=toolText;if(!dataObj){dataObj=dataStore[i]={graphics:{}}}else if(!dataObj.graphics){dataStore[i].graphics={}}config.hoverEffects=this._parseHoverEffectOptions(dataObj,setData);config.anchorProps.isAnchorHoverRadius=config.hoverEffects.anchorRadius}conf.xMax=xMax;conf.xMin=xMin;conf.yMin=yMin;conf.yMax=yMax;dataSet.ErrorValueConfigure&&dataSet.ErrorValueConfigure()};_proto._getHoveredPlot=function _getHoveredPlot(x,y){var res=this.config.dataTree.getNeighbour({x:x,y:y},true);if(res){return{pointIndex:res.index||res.i,hovered:true,pointObj:res.data}}};_proto.drawPlots=function drawPlots(){_LineDataset.prototype.drawPlots.call(this);this.setupHoverTracker()};_proto.getRegressionPoints=function getRegressionPoints(){var dataset=this,regression=dataset.getChildren("regression"),regressionPoints,xMax=-Infinity,xMin=Infinity,yMax=-Infinity,yMin=Infinity,i,j,k,line,points,regLineLength,regPointsLength;if(!regression||!regression.length||regression[0].getState("removed")){return}regressionPoints=regression[0]._config.regressionPoints||[];regLineLength=regressionPoints.length;for(i=0;i<regLineLength;i++){line=regressionPoints[i];for(j=0;j<line.length;j++){points=line[j]||[];regPointsLength=points.length;for(k=0;k<regPointsLength;k++){xMax=Math.max(xMax,points[k].x);xMin=Math.min(xMin,points[k].x);yMax=Math.max(yMax,points[k].y);yMin=Math.min(yMin,points[k].y)}}}return{max:yMax,min:yMin,xMax:xMax,xMin:xMin}};_proto.getDataLimits=function getDataLimits(){var dataset=this,conf=dataset.config,chart=dataset.getFromEnv("chart"),chartConfig=chart.config,max=conf.yMax,min=conf.yMin,xMax=conf.xMax,xMin=conf.xMin,infMin=-Infinity,infMax=+Infinity,transposeAxis=chartConfig.transposeAxis,regressionPoints=dataset.getRegressionPoints();if(dataset.getState("visible")===false&&transposeAxis){max=infMin;min=infMax;xMax=infMin;xMin=infMax}if(regressionPoints){max=Math.max(max,regressionPoints.max);min=Math.min(min,regressionPoints.min);xMax=Math.max(xMax,regressionPoints.xMax);xMin=Math.min(xMin,regressionPoints.xMin)}return{max:max,min:min,xMax:xMax,xMin:xMin}};_proto.getAxisValuePadding=function getAxisValuePadding(){return this.config.defaultValuePadding};_proto.getCanvasPadding=function getCanvasPadding(){var dataset=this,conf=dataset.config||(dataset.config={}),components=dataset.components||{},chartConfig=dataset.getFromEnv("chartConfig"),rotateValues=chartConfig.rotatevalues,xAxis=dataset.getFromEnv("xAxis"),yAxis=dataset.getFromEnv("yAxis"),reversexaxis=xAxis.config.isReverse,reverseyaxis=yAxis.config.isReverse,dataLabelStyle=dataset.getFromEnv("dataLabelStyle"),data=components.data||[],dataLen=data.length,firstData=conf.leftMostData||data[0],lastData=conf.rightMostData||data[data.length-1],topMostData=conf.topMostData,bottomMostData=conf.bottomMostData,radiusLimit=mathMin(chartConfig.canvasHeight,chartConfig.canvasWidth)/8,sqrtMaxZ,startValue=xAxis.getValue(0),firstDataChangeFlag=1,secondDataChangeFlag=1,radiusFactor,configAttr,configAttrFirst,configAttrLast,dataConf,anchorRadius,zMax=chartConfig.zMax,sqrtBubbleZ,minPoint,bubbleScale=conf.bubbleScale,i,xReduced,xReducedFirst,xReducedLast,label,bubbleRadius,bubbleRadiusVal,labelDimEnd={},labelDimStart={},anchorSpace=0,labelSpace=0,showValue,xAxisRange=xAxis.config.axisRange,xAxisMin=xAxisRange.min,xAxisMax=xAxisRange.max,yAxisRange=yAxis.config.axisRange,yAxisMin=yAxisRange.min,yAxisMax=yAxisRange.max,startPixel=xAxis.getPixel(xAxisMin),endPixel=xAxis.getPixel(xAxisMax),SmartLabel=dataset.getFromEnv("smartLabel"),returnDimension={paddingLeft:0,paddingRight:0},labelWidth=0,yReduced;sqrtMaxZ=Math.sqrt(zMax);radiusFactor=radiusLimit/sqrtMaxZ;for(i=0;i<dataLen;i++){configAttr=data[i].config;configAttrFirst=firstData.config;configAttrLast=lastData.config;sqrtBubbleZ=Math.sqrt(configAttr.z);bubbleRadius=Math.round(sqrtBubbleZ*radiusFactor)*bubbleScale||0;bubbleRadiusVal=xAxis.getValue(bubbleRadius)-startValue;xReduced=configAttr.x-bubbleRadiusVal/2;if(firstDataChangeFlag===1){sqrtBubbleZ=Math.sqrt(configAttrFirst.z);bubbleRadius=Math.round(sqrtBubbleZ*radiusFactor)*bubbleScale||0;bubbleRadiusVal=xAxis.getValue(bubbleRadius)-startValue;xReducedFirst=configAttrFirst.x-bubbleRadiusVal/2}if(secondDataChangeFlag===1){sqrtBubbleZ=Math.sqrt(configAttrLast.z);bubbleRadius=Math.round(sqrtBubbleZ*radiusFactor)*bubbleScale||0;bubbleRadiusVal=xAxis.getValue(bubbleRadius)-startValue;xReducedLast=configAttrLast.x-bubbleRadiusVal/2}firstDataChangeFlag=0;secondDataChangeFlag=0;if(xReducedFirst>xReduced){firstData=data[i];firstDataChangeFlag=1}if(xReducedLast<xReduced){lastData=data[i];secondDataChangeFlag=1}}if(firstData){dataConf=firstData.config;anchorRadius=dataConf.anchorProps.radius;showValue=dataConf.showValue;if(showValue){label=dataConf.displayValue;SmartLabel.useEllipsesOnOverflow(chartConfig.useEllipsesWhenOverflow);SmartLabel.setStyle(dataLabelStyle);labelDimStart=SmartLabel.getOriSize(label);labelWidth=rotateValues?labelDimStart.height:labelDimStart.width}if(dataConf.setValue!==null){xReduced=xAxis.getPixel(dataConf.setValue.x);if(reversexaxis){minPoint=xReduced-labelWidth*.5;labelSpace=endPixel-minPoint}else{minPoint=xReduced-labelWidth*.5;labelSpace=startPixel-minPoint}if(!reversexaxis&&xReduced-anchorRadius<=startPixel||reversexaxis&&xReduced-anchorRadius<=endPixel){anchorSpace=reversexaxis?endPixel-(xReduced-anchorRadius):startPixel-(xReduced-anchorRadius)}else{anchorSpace=0}}returnDimension.paddingLeft=mathMax(labelSpace,anchorSpace)}if(lastData){dataConf=lastData.config;showValue=dataConf.showValue;anchorRadius=dataConf.anchorProps.radius;if(showValue){label=dataConf.displayValue;SmartLabel.setStyle(dataLabelStyle);labelDimEnd=SmartLabel.getOriSize(label);labelWidth=rotateValues?labelDimEnd.height:labelDimEnd.width}if(dataConf.setValue!==null){xReduced=xAxis.getPixel(dataConf.setValue.x);minPoint=xReduced-startPixel+labelWidth*.5;labelSpace=minPoint-endPixel+startPixel;if(reversexaxis){labelSpace=minPoint}if(!reversexaxis&&xReduced+anchorRadius>=endPixel||reversexaxis&&xReduced+anchorRadius>=startPixel){anchorSpace=reversexaxis?xReduced+anchorRadius-startPixel:xReduced+anchorRadius-endPixel}else{anchorSpace=0}}returnDimension.paddingRight=mathMax(labelSpace,anchorSpace)}if(topMostData){dataConf=topMostData.config;anchorRadius=dataConf.anchorProps.radius||0;yAxisMax=yAxis.getPixel(yAxisMax);if(dataConf.setValue!==null){yReduced=yAxis.getPixel(dataConf.setValue.y);anchorSpace=(0,_lib.pluckNumber)(anchorRadius,0)+(0,_lib.pluckNumber)(dataConf.anchorProps.borderThickness,0)/2}var offset=reverseyaxis?yReduced-anchorSpace:yReduced+anchorSpace;var bound=reverseyaxis?yAxisMax:yAxisMin;returnDimension.paddingTop=Math.max(bound-offset,0)}if(bottomMostData){dataConf=bottomMostData.config;anchorRadius=dataConf.anchorProps.radius||0;yAxisMin=yAxis.getPixel(yAxisMin);if(dataConf.setValue!==null){yReduced=yAxis.getPixel(dataConf.setValue.y);anchorSpace=(0,_lib.pluckNumber)(anchorRadius,0)+(0,_lib.pluckNumber)(dataConf.anchorProps.borderThickness,0)/2}var _offset=reverseyaxis?yReduced+anchorSpace:yReduced-anchorSpace;var _bound=reverseyaxis?yAxisMin:yAxisMax;returnDimension.paddingBottom=Math.max(_offset-_bound,0)}return returnDimension};_proto._addLegend=function _addLegend(){var symbolColor,mFillColor,mLineColor,dataset=this,chart=dataset.getFromEnv("chart"),chartAttr=dataset.getFromEnv("chart-attrib"),conf=dataset.config,JSONData=dataset.config.JSONData||{},config,legendItem,legend=chart.getChildren("legend")[0],drawAnchors=(0,_lib.pluckNumber)(conf.drawanchors,1),marker={fillColor:getPointColor(conf.anchorbgcolor,conf.plotFillAlpha),lineColor:{FCcolor:{color:conf.anchorbordercolor,alpha:conf.anchoralpha}},lineWidth:conf.anchorborderthickness},item3dlighting=legend.config.symbol3DLighting;if(item3dlighting){if(marker.fillcolor&&marker.fillcolor.FCcolor){symbolColor=(0,_lib.extend2)({},marker.fillcolor);symbolColor.FCcolor.alpha=conf.plotFillAlpha}else{symbolColor=(0,_lib.pluck)(marker.fillColor)}}else{symbolColor={FCcolor:{color:(0,_lib.pluck)((mFillColor=marker.fillColor)&&(mFillColor.FCcolor&&mFillColor.FCcolor.color.split(COMMA)[0]||mFillColor)),angle:0,ratio:"0",alpha:"100"}}}config={enabled:conf.includeInLegend,type:dataset.type,drawLine:(0,_lib.pluck)(conf.drawLine,true),anchorSide:drawAnchors?conf.anchorsides:0,label:(0,_lib.getFirstValue)(dataset.config.JSONData.seriesname),legendIconAlpha:(0,_lib.pluckNumber)(JSONData.legendiconalpha)};if(conf.includeinlegend){legendItem=legend.getItem(dataset.config.legendItemId);if(!legendItem){dataset.config.legendItemId=legend.createItem(dataset);legendItem=legend.getItem(dataset.config.legendItemId);dataset.addExtEventListener("fc-click",(function(){legendItem.itemClickFn()}),legendItem)}else{legendItem.configure({style:legend.config.itemStyle,hiddenStyle:legend.config.itemHiddenStyle,datasetVisible:legend.config.datasetVisible,hoverStyle:legend.config.itemHoverStyle})}legendItem.configure(config);legendItem.setStateCosmetics("default",{symbol:{fill:conf.legendFillColor?conf.anchorbgcolor:(0,_lib.toRaphaelColor)(symbolColor),bgAlpha:(0,_lib.pluckNumber)(JSONData.legendiconbgalpha,JSONData.legendiconalpha,chartAttr.legendiconbgalpha,chartAttr.legendiconalpha,conf.plotFillAlpha),borderAlpha:(0,_lib.pluckNumber)(JSONData.legendiconborderalpha,JSONData.legendiconalpha,chartAttr.legendiconborderalpha,chartAttr.legendiconalpha,"100"),rawFillColor:conf.anchorbgcolor,rawStrokeColor:conf.lineColor,stroke:(0,_lib.toRaphaelColor)((0,_lib.pluck)((mLineColor=marker.lineColor)&&(mLineColor.FCcolor&&mLineColor.FCcolor.color.split(COMMA)[0]||mLineColor))),"stroke-width":conf.anchorborderthickness}});if(!dataset.getState("visible")){legendItem.setLegendState("hidden")}else{legendItem.removeLegendState("hidden")}}else if(dataset.config.legendItemId){legend.disposeItem(dataset.config.legendItemId)}};_proto.getDSGroupdef=function getDSGroupdef(){return UNDEF};_proto.trimData=function trimData(datasetJSON){if(!this.config.JSONData){return}var dataSet=this,config=dataSet.config,context=config&&config.context,prevCatlen=context&&context.prevCatlen,xAxis=dataSet.getFromEnv("xAxis"),currCatLen=xAxis.getTicksLen(),catDiff=prevCatlen-currCatLen,prevData=config.JSONData,prevDataLength=prevData.data&&prevData.data.length,currDataLength=datasetJSON.data&&datasetJSON.data.length||0,dataDiff=prevDataLength-currDataLength,diff,startIndex;if(catDiff>dataDiff){diff=catDiff;startIndex=currCatLen}else{diff=dataDiff;startIndex=currDataLength}if(diff>0){this.removeData(startIndex,diff,false)}};return ScatterDataset}(_line.default);var _default=exports.default=ScatterDataset;