UNPKG

@fusioncharts/fusiontime

Version:

FusionCharts JavaScript time-series charting framework

1 lines 31.1 kB
"use strict";var _interopRequireDefault=require("@babel/runtime/helpers/interopRequireDefault");exports.__esModule=true;exports.default=void 0;var _defineProperty2=_interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));var _inheritsLoose2=_interopRequireDefault(require("@babel/runtime/helpers/inheritsLoose"));var _equals=_interopRequireDefault(require("ramda/es/equals"));var _lib=require("@fusioncharts/core/src/lib");var _index=_interopRequireDefault(require("@fusioncharts/utils/src/chunker/index.js"));var _dependencyManager=require("@fusioncharts/core/src/dependency-manager");var _libGraphics=require("@fusioncharts/core/src/lib/lib-graphics");var _isValidNumber=_interopRequireDefault(require("@fusioncharts/utils/src/type/is-valid-number"));var _areaGenerator=_interopRequireDefault(require("@fusioncharts/utils/src/shape-generators/area-generator"));var _lineGenerator=_interopRequireDefault(require("@fusioncharts/utils/src/shape-generators/line-generator"));var _step=_interopRequireDefault(require("@fusioncharts/utils/src/shape-generators/curve-factories/step"));var _linear=_interopRequireDefault(require("@fusioncharts/utils/src/shape-generators/curve-factories/linear"));var _monotone=_interopRequireDefault(require("@fusioncharts/utils/src/shape-generators/curve-factories/monotone"));var _timeConverter=_interopRequireDefault(require("@fusioncharts/utils/src/time-converter"));var _column=_interopRequireDefault(require("./column"));var _line=_interopRequireDefault(require("./line.animation"));function ownKeys(e,r){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);r&&(o=o.filter((function(r){return Object.getOwnPropertyDescriptor(e,r).enumerable}))),t.push.apply(t,o)}return t}function _objectSpread(e){for(var r=1;r<arguments.length;r++){var t=null!=arguments[r]?arguments[r]:{};r%2?ownKeys(Object(t),!0).forEach((function(r){(0,_defineProperty2.default)(e,r,t[r])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(t)):ownKeys(Object(t)).forEach((function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(t,r))}))}return e}var HOVERED_ANCHOR_RADIUS=3.5,PLOT_HOVERED_ANCHOR_RADIUS=5.5,DEFAULT_LINE_LENGTH=10,DEFAULT_GAP_LENGTH=5,CRISP_CONSTANT=.0625,NONE="none",DEFAULT_COLOR="9194CC",VISIBLE="visible",SHOW="show",HIDE="hide",HIGHLIGHT="DataPlotHighlight",calculateMid=function calculateMid(a,b){return(a+b)/2},_reducerFn=function _reducerFn(s,t){return Object.assign(s,t)},unBlankify=function unBlankify(pathString){if(pathString===void 0){pathString=""}return pathString===""?"M0,0":pathString},crisper=function crisper(_ref){var x=_ref.x,y=_ref.y,width=_ref.width,height=_ref.height;return{y:y,height:height,x:x-CRISP_CONSTANT,width:width+CRISP_CONSTANT*2}},toPathRect=function toPathRect(acc,rect){var padding=2;return acc+"M"+rect.x+","+rect.y+"L"+(rect.x+rect.width+padding)+","+rect.y+"L"+(rect.x+rect.width+padding)+","+(rect.y+rect.height+padding)+"L"+rect.x+","+(rect.y+rect.height+padding)+"Z"};var maxRadius=5,LINE="line",AREA="area",WHITE="#ffffff",isWithinShape=function isWithinShape(pointObj,pX,x,y,component){var xPos,yPos,dx,dy,diff;if(!pointObj){return{pointIndex:pX,hovered:false,component:component}}xPos=pointObj.x;yPos=pointObj.y;dx=x-xPos;dy=y-yPos;diff=Math.sqrt(Math.pow(dx,2)+Math.pow(dy,2));return{pointIndex:pX,hovered:diff<=maxRadius,pointObj:pointObj,component:component}};function getGenerator(type){switch(type){case"area":case"smooth-area":case"step-area":return _areaGenerator.default;case"line":case"smooth-line":case"step-line":default:return _lineGenerator.default}}function getCurve(type){switch(type){case"smooth-line":case"smooth-area":return _monotone.default;case"step-area":case"step-line":return _step.default;case"line":case"area":default:return _linear.default}}function isArea(type){return type==="area"||type==="smooth-area"||type==="step-area"}function isLine(type){return type==="line"||type==="smooth-line"||type==="step-line"}(0,_dependencyManager.addDep)({name:"continuousAnimation",type:"animationRule",extension:_line.default});var Line=function(_Column){function Line(){var _this;_this=_Column.call(this)||this;_this.getHoverInConfig=function(hoverIndices,isDsHovered,isOtherDsHovered){if(isOtherDsHovered===void 0){isOtherDsHovered=false}return{hoverIndices:hoverIndices,hovered:true,radius:isDsHovered?PLOT_HOVERED_ANCHOR_RADIUS:HOVERED_ANCHOR_RADIUS,isDsHovered:isDsHovered,isOtherDsHovered:isOtherDsHovered}};_this.getHoverOutConfig=function(hoverIndices){return{hoverIndices:hoverIndices,hovered:false}};return _this}(0,_inheritsLoose2.default)(Line,_Column);var _proto=Line.prototype;_proto.getName=function getName(){return"continuous"};_proto.getHighlightedIndices=function getHighlightedIndices(range){var dataset=this,config=dataset.config,dataInfo=config.dataInfo,hightlightedPoints=[];dataInfo.forEach((function(data,index){if(data.y<=range.minValue&&data.y>=range.maxValue){hightlightedPoints.push(index)}}));return hightlightedPoints};_proto.__setDefaultConfig=function __setDefaultConfig(){_Column.prototype.__setDefaultConfig.call(this);var config=this.config;config["default-stroke"]=DEFAULT_COLOR;config["default-fill"]=DEFAULT_COLOR;config["default-anchor-stroke"]=(0,_libGraphics.convertColor)(WHITE);config.type=LINE;config.plotStyle={};config.nullPlotStyle={};config.linePlotStyle={};config.nullLinePlotStyle={};config.areaPlotStyle={};config.nullAreaPlotStyle={};config.anchorStyle={};config.anchorHoverInStyle={};config.anchorHoverOutStyle={};config.anchorHighlightObj={};config.defaultLineStyle={"stroke-opacity":1,"stroke-width":2,"stroke-dasharray":"none",fill:"none"};config.defaultNullLineStyle={"stroke-opacity":1,"stroke-width":2,"stroke-dasharray":[DEFAULT_LINE_LENGTH,DEFAULT_GAP_LENGTH],fill:"none"};config.defaultLinePredictiveStyle={"stroke-opacity":1,"stroke-width":1,"stroke-dasharray":5,fill:"none"};config.defaultAreaStyle={"stroke-opacity":1,"stroke-width":0,"fill-opacity":.6};config.defaultNullAreaStyle={"stroke-opacity":1,"stroke-width":0,"fill-opacity":.3};config.defaultAreaPredictiveStyle={"stroke-opacity":1,opacity:.5};config.defaultAnchorStyle={"fill-opacity":1,"stroke-width":1};config.willInjectNulls=true};_proto.configureAttributes=function configureAttributes(dataObj){var _this2=this;var config=this.config,id=this.getId(),getStyleDef=this.getFromEnv("getStyleDef");var isNullAndNonNullStylesSame=true;if(dataObj.hasOwnProperty("hoverIndices")){if(dataObj.hovered){config.mode=SHOW;config.sharedAnchorIndices=dataObj.hoverIndices}else{config.mode=HIDE;config.hideIndices=config.lastShownIndices}config.radius=dataObj.radius;config.isDsHovered=dataObj.isDsHovered;config.isOtherDsHovered=dataObj.isOtherDsHovered;config.hoverMode=true}else{Object.entries(dataObj).forEach((function(_ref2){var prop=_ref2[0],val=_ref2[1];if(prop==="primaryColor"){_this2.parsePrediction(dataObj);var primaryColor=val,plotConfig=dataObj.plotCosmetics,genericConfig=dataObj.genericCosmetics,styleConfig=dataObj.styleConfig,dsType=dataObj.type,plotStyleObj=config.plotStyle,styleObj=config.style,predictivePlotStyleObj=config.predictiveStyleAttributes,nullPlotStyleObj=config.nullPlotStyle,linePlotStyleObj=config.linePlotStyle,predictiveStyleAttributesLine=config.predictiveStyleAttributesLine,predictiveStyleAttributesArea=config.predictiveStyleAttributesArea,nullLinePlotStyleObj=config.nullLinePlotStyle,areaPlotStyleObj=config.areaPlotStyle,nullAreaPlotStyleObj=config.nullAreaPlotStyle,anchorStyleObj=config.anchorStyle,anchorHoverInStyleObj=config.anchorHoverInStyle,anchorHighlightObj=config.anchorHighlightObj,applicableClassStyleGeneric=getStyleDef(genericConfig.style&&genericConfig.style.plot),applicableClassStyleGenericNull=getStyleDef(genericConfig.style&&genericConfig.style["plot.null"]),applicableClassStyleGenericHover=getStyleDef(genericConfig.style&&genericConfig.style["plot:hover"]),applicableClassStyleGenericHighlight=getStyleDef(genericConfig.style&&genericConfig.style["plot:highlight"]),applicableClassStyleGenericLine=getStyleDef(genericConfig.style&&genericConfig.style.line),applicableClassStyleGenericLineNull=getStyleDef(genericConfig.style&&genericConfig.style["line.null"]),applicableClassStyleGenericArea=getStyleDef(genericConfig.style&&genericConfig.style.area),applicableClassStyleGenericAreaNull=getStyleDef(genericConfig.style&&genericConfig.style["area.null"]),applicableClassStyleGenericAnchor=getStyleDef(genericConfig.style&&genericConfig.style.anchor),applicableClassStyleGenericAnchorHover=getStyleDef(genericConfig.style&&genericConfig.style["anchor:hover"]),applicableClassStyleGenericAnchorHighlight=getStyleDef(genericConfig.style&&genericConfig.style["anchor:highlight"]),applicableClassStyleSpecific=getStyleDef(plotConfig.style&&plotConfig.style.plot),applicableClassStyleSpecificNull=getStyleDef(plotConfig.style&&plotConfig.style["plot.null"]),applicableClassStyleSpecificPredictive=getStyleDef(plotConfig.style&&plotConfig.style["plot.predictive"]),applicableClassStyleSpecificHover=getStyleDef(plotConfig.style&&plotConfig.style["plot:hover"]),applicableClassStyleSpecificHighlight=getStyleDef(plotConfig.style&&plotConfig.style["plot:highlight"]),applicableClassStyleSpecificLine=getStyleDef(plotConfig.style&&plotConfig.style.line),applicableClassStyleSpecificLineNull=getStyleDef(plotConfig.style&&plotConfig.style["line.null"]),applicableClassStyleSpecificLinePredictive=getStyleDef(plotConfig.style&&plotConfig.style["line.predictive"]),applicableClassStyleSpecificArea=getStyleDef(plotConfig.style&&plotConfig.style.area),applicableClassStyleSpecificAreaNull=getStyleDef(plotConfig.style&&plotConfig.style["area.null"]),applicableClassStyleSpecificAreaPredictive=getStyleDef(plotConfig.style&&plotConfig.style["area.predictive"]),applicableClassStyleSpecificAnchor=getStyleDef(plotConfig.style&&plotConfig.style.anchor),applicableClassStyleSpecificAnchorHover=getStyleDef(plotConfig.style&&plotConfig.style["anchor:hover"]),applicableClassStyleSpecificAnchorHighlight=getStyleDef(plotConfig.style&&plotConfig.style["anchor:highlight"]),applicableInlineStyle=getStyleDef(styleConfig.plot),applicableInlineStyleNull=getStyleDef(styleConfig["plot.null"]),applicableInlineStylePredictive=getStyleDef(styleConfig["plot.predictive"]),applicableInlineStyleHover=getStyleDef(styleConfig["plot:hover"]),applicableInlineStyleHighlight=getStyleDef(styleConfig["plot:highlight"]),applicableInlineStyleLine=getStyleDef(styleConfig.line),applicableInlineStyleLineNull=getStyleDef(styleConfig["line.null"]),applicableInlineStyleLinePredictive=getStyleDef(styleConfig["line.predictive"]),applicableInlineStyleArea=getStyleDef(styleConfig.area),applicableInlineStyleAreaNull=getStyleDef(styleConfig["area.null"]),applicableInlineStyleAreaPredictive=getStyleDef(styleConfig["area.predictive"]),applicableInlineStyleAnchor=getStyleDef(styleConfig.anchor),applicableInlineStyleAnchorHover=getStyleDef(styleConfig["anchor:hover"]),applicableInlineStyleAnchorHighlight=getStyleDef(styleConfig["anchor:highlight"]);config.defaultLineStyle["stroke-linecap"]="round";config.defaultNullLineStyle["stroke-linecap"]=isArea(dsType)?"butt":"round";config.defaultLinePredictiveStyle["stroke-linecap"]=isArea(dsType)?"butt":"round";[linePlotStyleObj,config.defaultLineStyle,applicableClassStyleGeneric,applicableClassStyleGenericLine,applicableInlineStyle,applicableClassStyleSpecific,applicableClassStyleSpecificLine,applicableInlineStyleLine].reduce(_reducerFn);[nullLinePlotStyleObj,config.defaultNullLineStyle,applicableClassStyleGenericNull,applicableClassStyleGenericLineNull,applicableInlineStyleNull,applicableClassStyleSpecificNull,applicableClassStyleSpecificLineNull,applicableInlineStyleLineNull].reduce(_reducerFn);[predictiveStyleAttributesLine,applicableInlineStylePredictive,applicableClassStyleSpecificPredictive,applicableClassStyleSpecificLinePredictive,applicableInlineStyleLinePredictive].reduce(_reducerFn);[areaPlotStyleObj,config.defaultAreaStyle,applicableClassStyleGeneric,applicableClassStyleGenericArea,applicableInlineStyle,applicableClassStyleSpecific,applicableClassStyleSpecificArea,applicableInlineStyleArea].reduce(_reducerFn);[nullAreaPlotStyleObj,config.defaultNullAreaStyle,applicableClassStyleGenericNull,applicableClassStyleGenericAreaNull,applicableInlineStyleNull,applicableClassStyleSpecificNull,applicableClassStyleSpecificAreaNull,applicableInlineStyleAreaNull].reduce(_reducerFn);[predictiveStyleAttributesArea,applicableInlineStylePredictive,applicableClassStyleSpecificPredictive,applicableClassStyleSpecificAreaPredictive,applicableInlineStyleAreaPredictive].reduce(_reducerFn);[anchorStyleObj,config.defaultAnchorStyle,applicableClassStyleGeneric,applicableClassStyleGenericAnchor,applicableInlineStyle,applicableClassStyleSpecific,applicableClassStyleSpecificAnchor,applicableInlineStyleAnchor].reduce(_reducerFn);plotStyleObj.fill=areaPlotStyleObj.fill=(0,_libGraphics.convertColor)((0,_lib.pluck)(primaryColor,config["default-fill"]),areaPlotStyleObj["fill-opacity"]*100);styleObj.fill=(0,_libGraphics.convertColor)((0,_lib.pluck)(primaryColor,config["default-stroke"]),styleObj["fill-opacity"]*100);nullPlotStyleObj.fill=nullAreaPlotStyleObj.fill=(0,_libGraphics.convertColor)((0,_lib.pluck)(nullAreaPlotStyleObj.fill,primaryColor,config["default-fill"]),nullAreaPlotStyleObj["fill-opacity"]*100);predictivePlotStyleObj.fill=predictiveStyleAttributesArea.fill=(0,_libGraphics.convertColor)((0,_lib.pluck)(predictiveStyleAttributesArea.fill,primaryColor,config["default-fill"]),predictiveStyleAttributesArea["fill-opacity"]*100);linePlotStyleObj.fill=NONE;nullLinePlotStyleObj.fill=NONE;predictiveStyleAttributesLine.fill=NONE;styleObj.stroke=(0,_libGraphics.convertColor)((0,_lib.pluck)(primaryColor,config["default-stroke"]),styleObj["stroke-opacity"]*100);areaPlotStyleObj.stroke=(0,_libGraphics.convertColor)((0,_lib.pluck)(primaryColor,config["default-stroke"]),areaPlotStyleObj["stroke-opacity"]*100);nullAreaPlotStyleObj.stroke=(0,_libGraphics.convertColor)((0,_lib.pluck)(nullAreaPlotStyleObj.stroke,primaryColor,config["default-stroke"]),nullAreaPlotStyleObj["stroke-opacity"]*100);predictiveStyleAttributesArea.stroke=(0,_libGraphics.convertColor)((0,_lib.pluck)(predictiveStyleAttributesArea.stroke,primaryColor,config["default-stroke"]),predictiveStyleAttributesArea["stroke-opacity"]*100);linePlotStyleObj.stroke=(0,_libGraphics.convertColor)((0,_lib.pluck)(primaryColor,config["default-stroke"]),linePlotStyleObj["stroke-opacity"]*100);nullLinePlotStyleObj.stroke=(0,_libGraphics.convertColor)((0,_lib.pluck)(nullLinePlotStyleObj.stroke,primaryColor,config["default-stroke"]),nullLinePlotStyleObj["stroke-opacity"]*100);predictiveStyleAttributesLine.stroke=(0,_libGraphics.convertColor)((0,_lib.pluck)(predictiveStyleAttributesLine.stroke,primaryColor,config["default-stroke"]),predictiveStyleAttributesLine["stroke-opacity"]*100);plotStyleObj.stroke=isArea(dsType)?areaPlotStyleObj.stroke:linePlotStyleObj.stroke;nullPlotStyleObj.stroke=isArea(dsType)?nullAreaPlotStyleObj.stroke:nullLinePlotStyleObj.stroke;predictivePlotStyleObj.stroke=isArea(dsType)?predictiveStyleAttributesArea.stroke:predictiveStyleAttributesLine.stroke;anchorStyleObj.fill=(0,_libGraphics.convertColor)((0,_lib.pluck)(primaryColor,config["default-stroke"]));anchorStyleObj.stroke=config["default-anchor-stroke"];[anchorHoverInStyleObj,anchorStyleObj,applicableClassStyleGenericHover,applicableClassStyleGenericAnchorHover,applicableClassStyleSpecificHover,applicableInlineStyleHover,applicableClassStyleSpecificAnchorHover,applicableInlineStyleAnchorHover].reduce(_reducerFn);[anchorHighlightObj,anchorStyleObj,applicableClassStyleGenericHighlight,applicableClassStyleGenericAnchorHighlight,applicableClassStyleSpecificHighlight,applicableInlineStyleHighlight,applicableClassStyleSpecificAnchorHighlight,applicableInlineStyleAnchorHighlight].reduce(_reducerFn);Object.keys(Object.assign(Object.assign({},anchorHoverInStyleObj),anchorHighlightObj)).forEach((function(styles){config.anchorHoverOutStyle[styles]=anchorStyleObj[styles]||""}));if(!Object.keys(anchorHighlightObj).length){anchorHighlightObj=config.anchorHighlightObj=(0,_lib.extend2)({},config.anchorHoverOutStyle)}config.connectNullData=(0,_lib.pluckNumber)(config.connectNullData,plotConfig.connectnulldata,genericConfig.connectnulldata,0);delete areaPlotStyleObj["fill-opacity"];delete nullAreaPlotStyleObj["fill-opacity"];delete areaPlotStyleObj["stroke-opacity"];delete nullAreaPlotStyleObj["stroke-opacity"];delete linePlotStyleObj["stroke-opacity"];delete nullLinePlotStyleObj["stroke-opacity"];delete config.predictiveStyleAttributesArea["fill-opacity"];delete config.predictiveStyleAttributesArea["stroke-opacity"];delete config.predictiveStyleAttributesLine["stroke-opacity"]}else{config[prop]=val}}));if(!config.useNullStyles){config.nullAreaPlotStyle=Object.assign({},config.areaPlotStyle);config.nullLinePlotStyle=Object.assign({},config.linePlotStyle)}isNullAndNonNullStylesSame=(0,_equals.default)(config.areaPlotStyle,config.nullAreaPlotStyle)&&(0,_equals.default)(config.linePlotStyle,config.nullLinePlotStyle);if(config.connectNullData&&isNullAndNonNullStylesSame){config.willInjectNulls=false}else{config.willInjectNulls=true}var chart=this.getFromEnv("chart");config.limit=this._calculateLimits();chart.setYScaleLimit(config.scaleY.getId(),id,config.limit.y,config.limit.baseRequired);chart.setXScaleLimit(config.scaleX.getId(),id,config.limit.x)}};_proto.parsePrediction=function parsePrediction(dataObject){this.config.prediction=dataObject.prediction||this.config.prediction;this.parsePredictiveStyleAttributes()};_proto.parsePredictiveStyleAttributes=function parsePredictiveStyleAttributes(){var predictiveStyleAttributes={},config=this.config;config.predictiveStyleAttributesLine={};config.predictiveStyleAttributesArea={};if(config.prediction.enabled){Object.assign(predictiveStyleAttributes,config.prediction.style.plot);Object.assign(config.predictiveStyleAttributesLine,config.defaultLinePredictiveStyle,config.prediction.style.plot,config.prediction.style.line);Object.assign(config.predictiveStyleAttributesArea,config.defaultAreaPredictiveStyle,config.prediction.style.plot,config.prediction.style.area)}config.predictiveStyleAttributes=predictiveStyleAttributes};_proto.getPadding=function getPadding(){var dataset=this,canvasConfig=dataset.getLinkedParent().config,config=dataset.config,anchorPadding,dataMarkerPadding;anchorPadding=dataset.getValueFromPx(PLOT_HOVERED_ANCHOR_RADIUS);dataMarkerPadding=canvasConfig.enableMarkers?dataset.getValueFromPx(config.dataMarkerPadding):0;return Math.ceil(Math.max(anchorPadding,dataMarkerPadding))};_proto._getRelevantInfo=function _getRelevantInfo(){var config=this.config;return{firstTimeStamp:config.firstTimeStamp,timeStampGap:config.timeStampGap,dataInfo:config.dataInfo,fill:config.plotStyle.stroke}};_proto.allocatePosition=function allocatePosition(){var dataset=this,config=dataset.config,_config$indices=config.indices,xIdx=_config$indices[0],yIdx=_config$indices[1],baseIdx=_config$indices[2],totalStackSum=_config$indices[3],seriesInfo=config.seriesInfo,dateColumn=dataset.getFromEnv("dateColumn"),isUTC=dataset.getFromEnv("UTC"),dsType=config.type,data=config.data,dataInfo=config.dataInfo,dataInfoNull=[],dataObj,binDecider=dataset.getFromEnv("binDecider"),xScale=dataset.getFromEnv("xScale"),yScale=dataset.getFromEnv("yScale"),xThresholdDuration=binDecider.getRangeThreshold()[2],nullClipAdjustment=Number.parseFloat(config.nullLinePlotStyle["stroke-width"]),predictionClipAdjustment=Number.parseFloat(config.predictiveStyleAttributesLine["stroke-width"]),clipAdjustment=Number.parseFloat(config.linePlotStyle["stroke-width"]),pathGenerator,startDate,endDate,midDate,nextData,nextMidDate,yValue,pX,base,y,yBaseValue,paddingInTimestamp,dataLen=data.length,_xScale$getDomain=xScale.getDomain(),startDomain=_xScale$getDomain[0],endDomain=_xScale$getDomain[1],bins=xScale.bins,i,len,xValue,duration,eventArgs,seriesName,format=dateColumn.format,formatter=isUTC?_timeConverter.default.utcFormatter(format):_timeConverter.default.formatter(format),isPlotOverTick=xScale.showPlotOverTick();config.firstTimeStamp=data&&data[0]&&data[0][xIdx]&&data[0][xIdx].start;if(config.repositioningDone=dataset._isRepositioningNeeded()){if(config.visibility!=="visible"){return}dataInfo=config.dataInfo=[];config.timeStampGap=xThresholdDuration;config.availableWidth=0;for(i=0,len=bins.length;i<len;i++){if(bins[i].clipType!==2){config.availableWidth=xScale.getRangeValue(bins[i].end)-xScale.getRangeValue(bins[i].start);break}}paddingInTimestamp=+xScale.getDomainValue(PLOT_HOVERED_ANCHOR_RADIUS)-+xScale.getDomainValue(0);config.actualStartDomain=+startDomain-paddingInTimestamp;config.actualEndDomain=+endDomain+paddingInTimestamp;data.forEach((function(d,index,dataArr){xValue=d[xIdx];yValue=d[yIdx];duration=xValue.config.duration;startDate=xValue.start;endDate=xValue.end;if(!isUTC){var tempDate=new Date(startDate),winterOffset=new Date(tempDate.getFullYear(),0).getTimezoneOffset(),summerOffset=new Date(tempDate.getFullYear(),6).getTimezoneOffset();if(winterOffset>summerOffset){}}midDate=calculateMid(startDate,endDate);nextData=dataArr[index+1];yBaseValue=d[baseIdx];if(Math.abs(yBaseValue)>Math.abs(yValue)){yValue=d[baseIdx];yBaseValue=d[yIdx]}base=yScale.getRangeValue(yBaseValue||Math.max(yScale.getDomain()[0],0));y=yScale.getRangeValue(yValue);if(!index){config.firstTimeStamp=startDate}if(dsType===AREA&&!(0,_isValidNumber.default)(base)){return}if((0,_isValidNumber.default)(yValue)&&(0,_isValidNumber.default)(y)){pX=xScale.getBinIndex(startDate);dataObj={startDate:startDate,endDate:endDate,timeInstant:isPlotOverTick?startDate:midDate,value:yValue,paddingInTimestamp:paddingInTimestamp,yBaseValue:dsType===AREA?yBaseValue:_lib.UNDEF,x:xScale.getRangeValue(new Date(startDate),new Date(endDate)),endXPosition:xScale.getRangeValue(new Date(startDate),new Date(endDate)),totalStackSum:(0,_lib.defined)(d[totalStackSum])?d[totalStackSum]:_lib.UNDEF,y:y,base:base};eventArgs={index:index,dataValue:yValue,start:startDate,startText:formatter.format(startDate),end:endDate,endText:formatter.format(endDate),binUnit:duration.Unit,binMultiplier:duration.number,plotType:config.type,timeFormatter:format,aggregation:config.aggregation,measure:config.measures[0],binValue:yValue,binValueFormatted:config.formatterFn&&config.formatterFn({value:yValue,type:"tooltip",prefix:config.prefix,suffix:config.suffix})};seriesName=Object.keys(seriesInfo)[0];if(seriesName){eventArgs.series=seriesName;eventArgs.seriesValue=seriesInfo[seriesName]}dataObj.eventArgs=eventArgs;dataInfo[pX]=dataObj;if(nextData){var nextPX=xScale.getBinIndex(nextData[xIdx].start);dataInfoNull.push(dataObj);nextMidDate=calculateMid(nextData[xIdx].start,nextData[xIdx].end);if(config.willInjectNulls&&nextMidDate-midDate-(xScale.clips[nextPX]-xScale.clips[pX])>xThresholdDuration*1.5){dataInfoNull.push(null)}}else if(dataLen-index===1){dataInfoNull.push(dataObj)}}else if(config.willInjectNulls){dataInfoNull.push(null)}}));pathGenerator=new _index.default(getGenerator(dsType)).setConnectUndefineds(config.connectNullData).setChunks({def:{clipAdjustment:clipAdjustment},undef:{clipAdjustment:nullClipAdjustment},predictive:{clipAdjustment:predictionClipAdjustment}}).setCurve(getCurve(dsType)).setDefined((function(d){return!!d})).setChunkDecider((function(d){return d.startDate>=config.prediction.dateMs?"predictive":"def"})).setXAccessor((function(d){return d.x})).setYAccessor((function(d){return d.y}));if(isArea(dsType)){pathGenerator.setYBaseAccessor((function(d){return d.base}))}config.chunks=pathGenerator.generate(dataInfoNull);config.path=unBlankify(config.chunks.def.path);config.clipPath=unBlankify(config.chunks.def.clipRects.map(crisper).reduce(toPathRect,""));config.nullPath=unBlankify(config.chunks.undef.path);config.nullClipPath=unBlankify(config.chunks.undef.clipRects.map(crisper).reduce(toPathRect,""));config.predictivePath=unBlankify(config.chunks.predictive.path);config.predictiveClipPath=unBlankify(config.chunks.predictive.clipRects.map(crisper).reduce(toPathRect,""));if(isArea(dsType)){config.topChunks=pathGenerator.getLineChunkerYTop().generate(dataInfoNull);config.topPath=unBlankify(config.topChunks.def.path);config.topClipPath=unBlankify(config.topChunks.def.clipRects.map(crisper).reduce(toPathRect,""));config.topNullPath=unBlankify(config.topChunks.undef.path);config.topNullClipPath=unBlankify(config.topChunks.undef.clipRects.map(crisper).reduce(toPathRect,""));config.topPredictivePath=unBlankify(config.topChunks.predictive.path);config.topPredictiveClipPath=unBlankify(config.topChunks.predictive.clipRects.map(crisper).reduce(toPathRect,""))}}};_proto._isInvalidTooltext=function _isInvalidTooltext(currData){var dataset=this,config=dataset.config;if(!currData||currData.timeInstant<config.actualStartDomain||currData.timeInstant>config.actualEndDomain){return true}};_proto._drawPlot=function _drawPlot(){var dataset=this,config=dataset.config,linePlotStyleObj=_objectSpread(_objectSpread({},config.linePlotStyle),{},{fill:"none"}),areaPlotStyleObj=config.areaPlotStyle,nullLinePlotStyleObj=_objectSpread(_objectSpread({},config.nullLinePlotStyle),{},{fill:"none"}),nullAreaPlotStyleObj=config.nullAreaPlotStyle,predictiveStyleAttributesLine=_objectSpread(_objectSpread({},config.predictiveStyleAttributesLine),{},{fill:"none"}),predictiveStyleAttributesArea=config.predictiveStyleAttributesArea,dataInfo=config.dataInfo,data;dataset.addGraphicalElement({el:"group",container:{id:"meso",label:"group"},component:dataset,label:"group",id:"meso-line",attr:{name:"line-common-meso",visibility:config.visibility}});dataset.addGraphicalElement({el:"group",container:{id:"thermo",label:"group"},component:dataset,label:"group",id:"thermo-line",attr:{name:"line-common-thermo",visibility:config.visibility}});dataset.addGraphicalElement({el:"group",container:{id:"meso-line",label:"group"},component:dataset,label:"group",id:"meso-plot",attr:{name:"line-plot-meso",visibility:config.visibility}},true);dataset.addGraphicalElement({el:"group",container:{id:"thermo-line",label:"group"},component:dataset,label:"group",id:"thermo-plot",attr:{name:"line-plot-thermo",visibility:config.visibility}},true);dataset.addGraphicalElement({el:"group",container:{id:"thermo-line",label:"group"},component:dataset,label:"group",id:"thermo-anchor",attr:{name:"line-anchor-thermo",visibility:config.visibility}},true);if(config.connectNullData){dataset.addGraphicalElement({el:"path",container:{label:"group",id:"meso-plot"},attr:Object.assign({path:config.nullPath,"clip-path":config.nullClipPath},isLine(config.type)?nullLinePlotStyleObj:nullAreaPlotStyleObj),label:"path",component:dataset},true)}dataset.addGraphicalElement({el:"path",container:{label:"group",id:"meso-plot"},attr:Object.assign({path:config.path,"clip-path":config.clipPath},isLine(config.type)?linePlotStyleObj:areaPlotStyleObj),label:"path",component:dataset},true);if(config.prediction.enabled){dataset.addGraphicalElement({el:"path",container:{label:"group",id:"meso-plot"},attr:Object.assign({path:config.predictivePath,"clip-path":config.predictiveClipPath},isLine(config.type)?predictiveStyleAttributesLine:predictiveStyleAttributesArea),label:"path",component:dataset},true)}if(config.topPath){if(config.connectNullData){dataset.addGraphicalElement({el:"path",container:{label:"group",id:"thermo-plot"},attr:Object.assign({path:config.topNullPath,"clip-path":config.topNullClipPath},nullLinePlotStyleObj),label:"topPath",component:dataset},true)}dataset.addGraphicalElement({el:"path",container:{label:"group",id:"thermo-plot"},attr:Object.assign({path:config.topPath,"clip-path":config.topClipPath},linePlotStyleObj),label:"topPath",component:dataset},true);if(config.prediction.enabled){dataset.addGraphicalElement({el:"path",container:{label:"group",id:"meso-plot"},attr:Object.assign({path:config.topPredictivePath,"clip-path":config.topPredictiveClipPath},predictiveStyleAttributesLine),label:"path",component:dataset},true)}}if(config.mode==="show"){if(config.sharedAnchorIndices&&config.sharedAnchorIndices.length){config.sharedAnchorIndices.forEach((function(index){data=dataInfo[index];config.lastShownIndices=config.sharedAnchorIndices;data&&!isNaN(data.value)&&dataset.addGraphicalElement({el:"path",container:{label:"group",id:"thermo-anchor"},attr:Object.assign({path:(0,_lib.polyPathToPath)([2,data.x,data.y,config.radius,0,0]),visibility:"show"},config.isDsHovered?config.anchorHoverInStyle:config.isOtherDsHovered?config.anchorStyle:config.anchorHighlightObj),id:"shared-anchor-"+index,label:config.dsType+"-anchor"})}))}}else{if(config.hideIndices&&config.hideIndices.length){config.hideIndices.forEach((function(index){data=dataInfo[index];data&&!isNaN(data.value)&&dataset.addGraphicalElement({el:"path",container:{label:"group",id:"meso-anchor"},attr:{visibility:"hidden"},id:"shared-anchor-"+index,label:config.dsType+"-anchor"})}))}}};_proto.setHoverInEffect=function setHoverInEffect(indices,isDsHovered,isOtherDsHovered){var dataset=this,chart=dataset.getFromEnv("chart"),dataInfo=dataset.config.dataInfo,eventArgs;dataset.getFromEnv("animationManager").setAnimationState("mouseOver");if(!isDsHovered){indices.forEach((function(index){if(dataInfo[index]){eventArgs=dataInfo[index].eventArgs;chart.fireChartInstanceEvent(HIGHLIGHT,eventArgs)}}))}this.setData(this.getHoverInConfig(indices,isDsHovered,isOtherDsHovered),true)};_proto._getHoveredPlot=function _getHoveredPlot(chartXArg,chartYArg){var dataset=this,chartX=chartXArg,chartY=chartYArg,xScale=dataset.getFromEnv("xScale"),xScaleRange=xScale.getRange(),dataMarkers=[dataset.getChildren("dataMarker")],config=dataset.config,visible=config.visibility===VISIBLE,dataInfo=config.dataInfo,len=dataInfo.length,canvas=dataset.getLinkedParent(),translationObj=canvas.getTranslation(),translationX=translationObj.x,translationY=translationObj.y,pointObj,xMin,xMax,returnValue,j,pX;chartX-=translationX;chartY-=translationY;if(chartX<xScaleRange[0]||chartX>xScaleRange[1]){return{component:dataset}}pX=xScale.getBinIndex(xScale.getDomainValue(chartX));xMin=Math.floor(Math.max(pX,0));xMax=Math.ceil(Math.min(pX,len-1));dataMarkers.forEach((function(dataMarkerArg){var dataMarker=dataMarkerArg;if(!returnValue&&dataMarker&&(dataMarker=dataMarker[0])){returnValue=dataMarker._checkPointOverMarker(pX,chartX,chartY,config.availableWidth)}}));if(!returnValue){for(j=xMax;j>=xMin;j--){pointObj=dataInfo[j];returnValue=visible?isWithinShape(pointObj,j,chartX,chartY,dataset):{};if(returnValue.hovered){break}}}!returnValue&&(returnValue={});if(!returnValue.hovered){returnValue.binIndexHovered=xScale.getBinIndex(xScale.getDomainValue(chartX));returnValue.pointObj=config.dataInfo[returnValue.binIndexHovered]||xScale.getBinBounds(pX);returnValue.component=dataset}else{returnValue.binIndexHovered=returnValue.pointIndex}config.binIndexHovered=returnValue.binIndexHovered;return returnValue};return Line}(_column.default);var _default=exports.default=Line;