/* @license C3.js v0.4.24 | (c) C3 Team and other contributors | http://c3js.org/ */ !function(t,e){"object"==typeof exports&&"undefined"!=typeof module?module.exports=e():"function"==typeof define&&define.amd?define(e):t.c3=e()}(this,function(){"use strict";var a,r,H={target:"c3-target",chart:"c3-chart",chartLine:"c3-chart-line",chartLines:"c3-chart-lines",chartBar:"c3-chart-bar",chartBars:"c3-chart-bars",chartText:"c3-chart-text",chartTexts:"c3-chart-texts",chartArc:"c3-chart-arc",chartArcs:"c3-chart-arcs",chartArcsTitle:"c3-chart-arcs-title",chartArcsBackground:"c3-chart-arcs-background",chartArcsGaugeUnit:"c3-chart-arcs-gauge-unit",chartArcsGaugeMax:"c3-chart-arcs-gauge-max",chartArcsGaugeMin:"c3-chart-arcs-gauge-min",selectedCircle:"c3-selected-circle",selectedCircles:"c3-selected-circles",eventRect:"c3-event-rect",eventRects:"c3-event-rects",eventRectsSingle:"c3-event-rects-single",eventRectsMultiple:"c3-event-rects-multiple",zoomRect:"c3-zoom-rect",brush:"c3-brush",focused:"c3-focused",defocused:"c3-defocused",region:"c3-region",regions:"c3-regions",title:"c3-title",tooltipContainer:"c3-tooltip-container",tooltip:"c3-tooltip",tooltipName:"c3-tooltip-name",shape:"c3-shape",shapes:"c3-shapes",line:"c3-line",lines:"c3-lines",bar:"c3-bar",bars:"c3-bars",circle:"c3-circle",circles:"c3-circles",arc:"c3-arc",arcLabelLine:"c3-arc-label-line",arcs:"c3-arcs",area:"c3-area",areas:"c3-areas",empty:"c3-empty",text:"c3-text",texts:"c3-texts",gaugeValue:"c3-gauge-value",grid:"c3-grid",gridLines:"c3-grid-lines",xgrid:"c3-xgrid",xgrids:"c3-xgrids",xgridLine:"c3-xgrid-line",xgridLines:"c3-xgrid-lines",xgridFocus:"c3-xgrid-focus",ygrid:"c3-ygrid",ygrids:"c3-ygrids",ygridLine:"c3-ygrid-line",ygridLines:"c3-ygrid-lines",axis:"c3-axis",axisX:"c3-axis-x",axisXLabel:"c3-axis-x-label",axisY:"c3-axis-y",axisYLabel:"c3-axis-y-label",axisY2:"c3-axis-y2",axisY2Label:"c3-axis-y2-label",legendBackground:"c3-legend-background",legendItem:"c3-legend-item",legendItemEvent:"c3-legend-item-event",legendItemTile:"c3-legend-item-tile",legendItemHidden:"c3-legend-item-hidden",legendItemFocused:"c3-legend-item-focused",dragarea:"c3-dragarea",EXPANDED:"_expanded_",SELECTED:"_selected_",INCLUDED:"_included_"},o="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},P=function(t){return t||0===t},h=function(t){return"function"==typeof t},s=function(t){return Array.isArray(t)},c=function(t){return"string"==typeof t},v=function(t){return void 0===t},k=function(t){return void 0!==t},n=function(t){return 10*Math.ceil(t/10)},d=function(t){return Math.ceil(t)+.5},D=function(t){return t[1]-t[0]},u=function(t){return null==t||c(t)&&0===t.length||"object"===(void 0===t?"undefined":o(t))&&0===Object.keys(t).length},C=function(t){return!p.isEmpty(t)},B=function(t,e,i){return k(t[e])?t[e]:i},i=function(e,i){var n=!1;return Object.keys(e).forEach(function(t){e[t]===i&&(n=!0)}),n},_=function(t){return"string"==typeof t?t.replace(//g,">"):t},m=function(t){var e=t.getBoundingClientRect(),i=[t.pathSegList.getItem(0),t.pathSegList.getItem(1)];return{x:i[0].x,y:Math.min(i[0].y,i[1].y),width:e.width,height:e.height}};function l(t,e){var i=this;i.component=t,i.params=e||{},i.d3=t.d3,i.scale=i.d3.scale.linear(),i.range,i.orient="bottom",i.innerTickSize=6,i.outerTickSize=this.params.withOuterTick?6:0,i.tickPadding=3,i.tickValues=null,i.tickFormat,i.tickArguments,i.tickOffset=0,i.tickCulling=!0,i.tickCentered,i.tickTextCharSize,i.tickTextRotate=i.params.tickTextRotate,i.tickLength,i.axis=i.generateAxis()}(r=l.prototype).axisX=function(t,e,i){t.attr("transform",function(t){return"translate("+Math.ceil(e(t)+i)+", 0)"})},r.axisY=function(t,e){t.attr("transform",function(t){return"translate(0,"+Math.ceil(e(t))+")"})},r.scaleExtent=function(t){var e=t[0],i=t[t.length-1];return ee.getTotalLength())break;i--}while(0=this.numberOfItems)throw"INDEX_SIZE_ERR"},window.SVGPathSegList.prototype.getItem=function(t){return this._checkPathSynchronizedToList(),this._checkValidIndex(t),this._list[t]},window.SVGPathSegList.prototype.insertItemBefore=function(t,e){return this._checkPathSynchronizedToList(),e>this.numberOfItems&&(e=this.numberOfItems),t._owningPathSegList&&(t=t.clone()),this._list.splice(e,0,t),(t._owningPathSegList=this)._writeListToPath(),t},window.SVGPathSegList.prototype.replaceItem=function(t,e){return this._checkPathSynchronizedToList(),t._owningPathSegList&&(t=t.clone()),this._checkValidIndex(e),((this._list[e]=t)._owningPathSegList=this)._writeListToPath(),t},window.SVGPathSegList.prototype.removeItem=function(t){this._checkPathSynchronizedToList(),this._checkValidIndex(t);var e=this._list[t];return this._list.splice(t,1),this._writeListToPath(),e},window.SVGPathSegList.prototype.appendItem=function(t){return this._checkPathSynchronizedToList(),t._owningPathSegList&&(t=t.clone()),this._list.push(t),(t._owningPathSegList=this)._writeListToPath(),t},window.SVGPathSegList._pathSegArrayAsString=function(t){var e="",i=!0;return t.forEach(function(t){i?(i=!1,e+=t._asPathString()):e+=" "+t._asPathString()}),e},window.SVGPathSegList.prototype._parsePath=function(t){if(!t||0==t.length)return[];var n=this,e=function(){this.pathSegList=[]};e.prototype.appendSegment=function(t){this.pathSegList.push(t)};var i=function(t){this._string=t,this._currentIndex=0,this._endIndex=this._string.length,this._previousCommand=window.SVGPathSeg.PATHSEG_UNKNOWN,this._skipOptionalSpaces()};i.prototype._isCurrentSpace=function(){var t=this._string[this._currentIndex];return t<=" "&&(" "==t||"\n"==t||"\t"==t||"\r"==t||"\f"==t)},i.prototype._skipOptionalSpaces=function(){for(;this._currentIndex=this._endIndex||this._string.charAt(this._currentIndex)<"0"||"9"=this._endIndex||this._string.charAt(this._currentIndex)<"0"||"9"=this._endIndex)){var t=!1,e=this._string.charAt(this._currentIndex++);if("0"==e)t=!1;else{if("1"!=e)return;t=!0}return this._skipOptionalSpacesOrDelimiter(),t}},i.prototype.parseSegment=function(){var t=this._string[this._currentIndex],e=this._pathSegTypeFromChar(t);if(e==window.SVGPathSeg.PATHSEG_UNKNOWN){if(this._previousCommand==window.SVGPathSeg.PATHSEG_UNKNOWN)return null;if((e=this._nextCommandHelper(t,this._previousCommand))==window.SVGPathSeg.PATHSEG_UNKNOWN)return null}else this._currentIndex++;switch(this._previousCommand=e){case window.SVGPathSeg.PATHSEG_MOVETO_REL:return new window.SVGPathSegMovetoRel(n,this._parseNumber(),this._parseNumber());case window.SVGPathSeg.PATHSEG_MOVETO_ABS:return new window.SVGPathSegMovetoAbs(n,this._parseNumber(),this._parseNumber());case window.SVGPathSeg.PATHSEG_LINETO_REL:return new window.SVGPathSegLinetoRel(n,this._parseNumber(),this._parseNumber());case window.SVGPathSeg.PATHSEG_LINETO_ABS:return new window.SVGPathSegLinetoAbs(n,this._parseNumber(),this._parseNumber());case window.SVGPathSeg.PATHSEG_LINETO_HORIZONTAL_REL:return new window.SVGPathSegLinetoHorizontalRel(n,this._parseNumber());case window.SVGPathSeg.PATHSEG_LINETO_HORIZONTAL_ABS:return new window.SVGPathSegLinetoHorizontalAbs(n,this._parseNumber());case window.SVGPathSeg.PATHSEG_LINETO_VERTICAL_REL:return new window.SVGPathSegLinetoVerticalRel(n,this._parseNumber());case window.SVGPathSeg.PATHSEG_LINETO_VERTICAL_ABS:return new window.SVGPathSegLinetoVerticalAbs(n,this._parseNumber());case window.SVGPathSeg.PATHSEG_CLOSEPATH:return this._skipOptionalSpaces(),new window.SVGPathSegClosePath(n);case window.SVGPathSeg.PATHSEG_CURVETO_CUBIC_REL:var i={x1:this._parseNumber(),y1:this._parseNumber(),x2:this._parseNumber(),y2:this._parseNumber(),x:this._parseNumber(),y:this._parseNumber()};return new window.SVGPathSegCurvetoCubicRel(n,i.x,i.y,i.x1,i.y1,i.x2,i.y2);case window.SVGPathSeg.PATHSEG_CURVETO_CUBIC_ABS:return i={x1:this._parseNumber(),y1:this._parseNumber(),x2:this._parseNumber(),y2:this._parseNumber(),x:this._parseNumber(),y:this._parseNumber()},new window.SVGPathSegCurvetoCubicAbs(n,i.x,i.y,i.x1,i.y1,i.x2,i.y2);case window.SVGPathSeg.PATHSEG_CURVETO_CUBIC_SMOOTH_REL:return i={x2:this._parseNumber(),y2:this._parseNumber(),x:this._parseNumber(),y:this._parseNumber()},new window.SVGPathSegCurvetoCubicSmoothRel(n,i.x,i.y,i.x2,i.y2);case window.SVGPathSeg.PATHSEG_CURVETO_CUBIC_SMOOTH_ABS:return i={x2:this._parseNumber(),y2:this._parseNumber(),x:this._parseNumber(),y:this._parseNumber()},new window.SVGPathSegCurvetoCubicSmoothAbs(n,i.x,i.y,i.x2,i.y2);case window.SVGPathSeg.PATHSEG_CURVETO_QUADRATIC_REL:return i={x1:this._parseNumber(),y1:this._parseNumber(),x:this._parseNumber(),y:this._parseNumber()},new window.SVGPathSegCurvetoQuadraticRel(n,i.x,i.y,i.x1,i.y1);case window.SVGPathSeg.PATHSEG_CURVETO_QUADRATIC_ABS:return i={x1:this._parseNumber(),y1:this._parseNumber(),x:this._parseNumber(),y:this._parseNumber()},new window.SVGPathSegCurvetoQuadraticAbs(n,i.x,i.y,i.x1,i.y1);case window.SVGPathSeg.PATHSEG_CURVETO_QUADRATIC_SMOOTH_REL:return new window.SVGPathSegCurvetoQuadraticSmoothRel(n,this._parseNumber(),this._parseNumber());case window.SVGPathSeg.PATHSEG_CURVETO_QUADRATIC_SMOOTH_ABS:return new window.SVGPathSegCurvetoQuadraticSmoothAbs(n,this._parseNumber(),this._parseNumber());case window.SVGPathSeg.PATHSEG_ARC_REL:return i={x1:this._parseNumber(),y1:this._parseNumber(),arcAngle:this._parseNumber(),arcLarge:this._parseArcFlag(),arcSweep:this._parseArcFlag(),x:this._parseNumber(),y:this._parseNumber()},new window.SVGPathSegArcRel(n,i.x,i.y,i.x1,i.y1,i.arcAngle,i.arcLarge,i.arcSweep);case window.SVGPathSeg.PATHSEG_ARC_ABS:return i={x1:this._parseNumber(),y1:this._parseNumber(),arcAngle:this._parseNumber(),arcLarge:this._parseArcFlag(),arcSweep:this._parseArcFlag(),x:this._parseNumber(),y:this._parseNumber()},new window.SVGPathSegArcAbs(n,i.x,i.y,i.x1,i.y1,i.arcAngle,i.arcLarge,i.arcSweep);default:throw"Unknown path seg type."}};var a=new e,r=new i(t);if(!r.initialCommandIsMoveTo())return[];for(;r.hasMoreData();){var s=r.parseSegment();if(!s)return[];a.appendSegment(s)}return a.pathSegList}),String.prototype.padEnd||(String.prototype.padEnd=function(t,e){return t>>=0,e=String(void 0!==e?e:" "),this.length>t?String(this):((t-=this.length)>e.length&&(e+=e.repeat(t/e.length)),String(this)+e.slice(0,t))}),f.axis=function(){},f.axis.labels=function(e){var i=this.internal;arguments.length&&(Object.keys(e).forEach(function(t){i.axis.setLabelText(t,e[t])}),i.axis.updateLabels())},f.axis.max=function(t){var e=this.internal,i=e.config;if(!arguments.length)return{x:i.axis_x_max,y:i.axis_y_max,y2:i.axis_y2_max};"object"===(void 0===t?"undefined":o(t))?(P(t.x)&&(i.axis_x_max=t.x),P(t.y)&&(i.axis_y_max=t.y),P(t.y2)&&(i.axis_y2_max=t.y2)):i.axis_y_max=i.axis_y2_max=t,e.redraw({withUpdateOrgXDomain:!0,withUpdateXDomain:!0})},f.axis.min=function(t){var e=this.internal,i=e.config;if(!arguments.length)return{x:i.axis_x_min,y:i.axis_y_min,y2:i.axis_y2_min};"object"===(void 0===t?"undefined":o(t))?(P(t.x)&&(i.axis_x_min=t.x),P(t.y)&&(i.axis_y_min=t.y),P(t.y2)&&(i.axis_y2_min=t.y2)):i.axis_y_min=i.axis_y2_min=t,e.redraw({withUpdateOrgXDomain:!0,withUpdateXDomain:!0})},f.axis.range=function(t){if(!arguments.length)return{max:this.axis.max(),min:this.axis.min()};k(t.max)&&this.axis.max(t.max),k(t.min)&&this.axis.min(t.min)},f.category=function(t,e){var i=this.internal,n=i.config;return 1'":;\[\]\/|~`{}\\]/g,"-"):""},p.selectorTarget=function(t,e){return(e||"")+"."+H.target+this.getTargetSelectorSuffix(t)},p.selectorTargets=function(t,e){var i=this;return(t=t||[]).length?t.map(function(t){return i.selectorTarget(t,e)}):null},p.selectorLegend=function(t){return"."+H.legendItem+this.getTargetSelectorSuffix(t)},p.selectorLegends=function(t){var e=this;return t&&t.length?t.map(function(t){return e.selectorLegend(t)}):null},p.getClipPath=function(t){return"url("+(0<=window.navigator.appVersion.toLowerCase().indexOf("msie 9.")?"":document.URL.split("#")[0])+"#"+t+")"},p.appendClip=function(t,e){return t.append("clipPath").attr("id",e).append("rect")},p.getAxisClipX=function(t){var e=Math.max(30,this.margin.left);return t?-(1+e):-(e-1)},p.getAxisClipY=function(t){return t?-20:-this.margin.top},p.getXAxisClipX=function(){return this.getAxisClipX(!this.config.axis_rotated)},p.getXAxisClipY=function(){return this.getAxisClipY(!this.config.axis_rotated)},p.getYAxisClipX=function(){return this.config.axis_y_inner?-1:this.getAxisClipX(this.config.axis_rotated)},p.getYAxisClipY=function(){return this.getAxisClipY(this.config.axis_rotated)},p.getAxisClipWidth=function(t){var e=Math.max(30,this.margin.left),i=Math.max(30,this.margin.right);return t?this.width+2+e+i:this.margin.left+20},p.getAxisClipHeight=function(t){return(t?this.margin.bottom:this.margin.top+this.height)+20},p.getXAxisClipWidth=function(){return this.getAxisClipWidth(!this.config.axis_rotated)},p.getXAxisClipHeight=function(){return this.getAxisClipHeight(!this.config.axis_rotated)},p.getYAxisClipWidth=function(){return this.getAxisClipWidth(this.config.axis_rotated)+(this.config.axis_y_inner?20:0)},p.getYAxisClipHeight=function(){return this.getAxisClipHeight(this.config.axis_rotated)},p.generateColor=function(){var t=this.config,e=this.d3,n=t.data_colors,a=C(t.color_pattern)?t.color_pattern:e.scale.category10().range(),r=t.data_color,s=[];return function(t){var e,i=t.id||t.data&&t.data.id||t;return n[i]instanceof Function?e=n[i](t):n[i]?e=n[i]:(s.indexOf(i)<0&&s.push(i),e=a[s.indexOf(i)%a.length],n[i]=e),r instanceof Function?r(e,t):e}},p.generateLevelColor=function(){var t=this.config,n=t.color_pattern,e=t.color_threshold,a="value"===e.unit,r=e.values&&e.values.length?e.values:[],s=e.max||100;return C(t.color_threshold)?function(t){var e,i=n[n.length-1];for(e=0;en&&(n=(e=t).values.length)}):e=i?t[0]:null,e},p.getEdgeX=function(t){return t.length?[this.d3.min(t,function(t){return t.values[0].x}),this.d3.max(t,function(t){return t.values[t.values.length-1].x})]:[0,0]},p.mapToIds=function(t){return t.map(function(t){return t.id})},p.mapToTargetIds=function(t){return t?[].concat(t):this.mapToIds(this.data.targets)},p.hasTarget=function(t,e){var i,n=this.mapToIds(t);for(i=0;io&&(s=s.filter(function(t){return(""+t).indexOf(".")<0}));return s},p.getGridFilterToRemove=function(t){return t?function(e){var i=!1;return[].concat(t).forEach(function(t){("value"in t&&e.value===t.value||"class"in t&&e.class===t.class)&&(i=!0)}),i}:function(){return!0}},p.removeGridLines=function(t,e){var i=this.config,n=this.getGridFilterToRemove(t),a=function(t){return!n(t)},r=e?H.xgridLines:H.ygridLines,s=e?H.xgridLine:H.ygridLine;this.main.select("."+r).selectAll("."+s).filter(n).transition().duration(i.transition_duration).style("opacity",0).remove(),e?i.grid_x_lines=i.grid_x_lines.filter(a):i.grid_y_lines=i.grid_y_lines.filter(a)},p.initEventRect=function(){this.main.select("."+H.chart).append("g").attr("class",H.eventRects).style("fill-opacity",0)},p.redrawEventRect=function(){var t,e,i=this,n=i.config,a=i.isMultipleX(),r=i.main.select("."+H.eventRects).style("cursor",n.zoom_enabled?n.axis_rotated?"ns-resize":"ew-resize":null).classed(H.eventRectsMultiple,a).classed(H.eventRectsSingle,!a);r.selectAll("."+H.eventRect).remove(),i.eventRect=r.selectAll("."+H.eventRect),a?(t=i.eventRect.data([0]),i.generateEventRectsForMultipleXs(t.enter()),i.updateEventRect(t)):(e=i.getMaxDataCountTarget(i.data.targets),r.datum(e?e.values:[]),i.eventRect=r.selectAll("."+H.eventRect),t=i.eventRect.data(function(t){return t}),i.generateEventRectsForSingleX(t.enter()),i.updateEventRect(t),t.exit().remove())},p.updateEventRect=function(t){var e,i,n,a,r,s,o=this,c=o.config;t=t||o.eventRect.data(function(t){return t}),o.isMultipleX()?(i=e=0,n=o.width,a=o.height):(!o.isCustomX()&&!o.isTimeSeries()||o.isCategorized()?(r=o.getEventRectWidth(),s=function(t){return o.x(t.x)-r/2}):(o.updateXs(),r=function(t){var e=o.getPrevX(t.index),i=o.getNextX(t.index);return null===e&&null===i?c.axis_rotated?o.height:o.width:(null===e&&(e=o.x.domain()[0]),null===i&&(i=o.x.domain()[1]),Math.max(0,(o.x(i)-o.x(e))/2))},s=function(t){var e=o.getPrevX(t.index),i=o.getNextX(t.index),n=o.data.xs[t.id][t.index];return null===e&&null===i?0:(null===e&&(e=o.x.domain()[0]),(o.x(n)+o.x(e))/2)}),e=c.axis_rotated?0:s,i=c.axis_rotated?s:0,n=c.axis_rotated?o.width:r,a=c.axis_rotated?r:o.height),t.attr("class",o.classEvent.bind(o)).attr("x",e).attr("y",i).attr("width",n).attr("height",a)},p.generateEventRectsForSingleX=function(t){var a=this,r=a.d3,s=a.config;t.append("rect").attr("class",a.classEvent.bind(a)).style("cursor",s.data_selection_enabled&&s.data_selection_grouped?"pointer":null).on("mouseover",function(t){var e=t.index;a.dragging||a.flowing||a.hasArcType()||(s.point_focus_expand_enabled&&a.expandCircles(e,null,!0),a.expandBars(e,null,!0),a.main.selectAll("."+H.shape+"-"+e).each(function(t){s.data_onmouseover.call(a.api,t)}))}).on("mouseout",function(t){var e=t.index;a.config&&(a.hasArcType()||(a.hideXGridFocus(),a.hideTooltip(),a.unexpandCircles(),a.unexpandBars(),a.main.selectAll("."+H.shape+"-"+e).each(function(t){s.data_onmouseout.call(a.api,t)})))}).on("mousemove",function(t){var e,i=t.index,n=a.svg.select("."+H.eventRect+"-"+i);a.dragging||a.flowing||a.hasArcType()||(a.isStepType(t)&&"step-after"===a.config.line_step_type&&r.mouse(this)[0]i.bar_width_max?i.bar_width_max:n},p.getBars=function(t,e){return(e?this.main.selectAll("."+H.bars+this.getTargetSelectorSuffix(e)):this.main).selectAll("."+H.bar+(P(t)?"-"+t:""))},p.expandBars=function(t,e,i){i&&this.unexpandBars(),this.getBars(t,e).classed(H.EXPANDED,!0)},p.unexpandBars=function(t){this.getBars(t).classed(H.EXPANDED,!1)},p.generateDrawBar=function(t,e){var r=this.config,s=this.generateGetBarPoints(t,e);return function(t,e){var i=s(t,e),n=r.axis_rotated?1:0,a=r.axis_rotated?0:1;return"M "+i[0][n]+","+i[0][a]+" L"+i[1][n]+","+i[1][a]+" L"+i[2][n]+","+i[2][a]+" L"+i[3][n]+","+i[3][a]+" z"}},p.generateGetBarPoints=function(t,e){var s=this,i=e?s.subXAxis:s.xAxis,n=t.__max__+1,o=s.getBarW(i,n),c=s.getShapeX(o,n,t,!!e),d=s.getShapeY(!!e),l=s.getShapeOffset(s.isBarType,t,!!e),u=o*(s.config.bar_space/2),h=e?s.getSubYScale:s.getYScale;return function(t,e){var i=h.call(s,t.id)(0),n=l(t,e)||i,a=c(t),r=d(t);return s.config.axis_rotated&&(0r.width?n=r.width-s.width:n<0&&(n=4)),n},p.getYForText=function(t,e,i){var n,a=this,r=i.getBoundingClientRect();return a.config.axis_rotated?n=(t[0][0]+t[2][0]+.6*r.height)/2:(n=t[2][1],e.value<0||0===e.value&&!a.hasPositiveValue?(n+=r.height,a.isBarType(e)&&a.isSafari()?n-=3:!a.isBarType(e)&&a.isChrome()&&(n+=3)):n+=a.isBarType(e)?-3:-6),null!==e.value||a.config.axis_rotated||(nthis.height&&(n=this.height-4)),n},p.initTitle=function(){this.title=this.svg.append("text").text(this.config.title_text).attr("class",this.CLASS.title)},p.redrawTitle=function(){var t=this;t.title.attr("x",t.xForTitle.bind(t)).attr("y",t.yForTitle.bind(t))},p.xForTitle=function(){var t=this,e=t.config,i=e.title_position||"left";return 0<=i.indexOf("right")?t.currentWidth-t.getTextRect(t.title.node().textContent,t.CLASS.title,t.title.node()).width-e.title_padding.right:0<=i.indexOf("center")?(t.currentWidth-t.getTextRect(t.title.node().textContent,t.CLASS.title,t.title.node()).width)/2:e.title_padding.left},p.yForTitle=function(){var t=this;return t.config.title_padding.top+t.getTextRect(t.title.node().textContent,t.CLASS.title,t.title.node()).height},p.getTitlePadding=function(){return this.yForTitle()+this.config.title_padding.bottom},p.initTooltip=function(){var t,e=this,i=e.config;if(e.tooltip=e.selectChart.style("position","relative").append("div").attr("class",H.tooltipContainer).style("position","absolute").style("pointer-events","none").style("display","none"),i.tooltip_init_show){if(e.isTimeSeries()&&c(i.tooltip_init_x)){for(i.tooltip_init_x=e.parseDate(i.tooltip_init_x),t=0;t"+(s||0===s?""+s+"":"")),void 0!==(o=_(f(t[r].value,t[r].ratio,t[r].id,t[r].index,t))))){if(null===t[r].name)continue;c=_(g(t[r].name,t[r].ratio,t[r].id,t[r].index)),d=l.levelColor?l.levelColor(t[r].value):n(t[r].id),a+="",a+=""+c+"",a+=""+o+"",a+=""}return a+""},p.tooltipPosition=function(t,e,i,n){var a,r,s,o,c,d=this,l=d.config,u=d.d3,h=d.hasArcType(),g=u.mouse(n);return h?(r=(d.width-(d.isLegendRight?d.getLegendWidth():0))/2+g[0],o=(d.hasType("gauge")?d.height:d.height/2)+g[1]+20):(a=d.getSvgLeft(!0),l.axis_rotated?(s=(r=a+g[0]+100)+e,c=d.currentWidth-d.getCurrentPaddingRight(),o=d.x(t[0].x)+20):(s=(r=a+d.getCurrentPaddingLeft(!0)+d.x(t[0].x)+20)+e,c=a+d.currentWidth-d.getCurrentPaddingRight(),o=g[1]+15),cd.currentHeight&&(o-=i+30)),o<0&&(o=0),{top:o,left:r}},p.showTooltip=function(t,e){var i,n,a,r=this,s=r.config,o=r.hasArcType(),c=t.filter(function(t){return t&&P(t.value)}),d=s.tooltip_position||p.tooltipPosition;0!==c.length&&s.tooltip_show&&(r.tooltip.html(s.tooltip_contents.call(r,t,r.axis.getXAxisTickFormat(),r.getYFormat(o),r.color)).style("display","block"),i=r.tooltip.property("offsetWidth"),n=r.tooltip.property("offsetHeight"),a=d.call(this,c,i,n,e),r.tooltip.style("top",a.top+"px").style("left",a.left+"px"))},p.hideTooltip=function(){this.tooltip.style("display","none")},p.setTargetType=function(t,e){var i=this,n=i.config;i.mapToTargetIds(t).forEach(function(t){i.withoutFadeIn[t]=e===n.data_types[t],n.data_types[t]=e}),t||(n.data_type=e)},p.hasType=function(i,t){var n=this.config.data_types,a=!1;return(t=t||this.data.targets)&&t.length?t.forEach(function(t){var e=n[t.id];(e&&0<=e.indexOf(i)||!e&&"line"===i)&&(a=!0)}):Object.keys(n).length?Object.keys(n).forEach(function(t){n[t]===i&&(a=!0)}):a=this.config.data_type===i,a},p.hasArcType=function(t){return this.hasType("pie",t)||this.hasType("donut",t)||this.hasType("gauge",t)},p.isLineType=function(t){var e=this.config,i=c(t)?t:t.id;return!e.data_types[i]||0<=["line","spline","area","area-spline","step","area-step"].indexOf(e.data_types[i])},p.isStepType=function(t){var e=c(t)?t:t.id;return 0<=["step","area-step"].indexOf(this.config.data_types[e])},p.isSplineType=function(t){var e=c(t)?t:t.id;return 0<=["spline","area-spline"].indexOf(this.config.data_types[e])},p.isAreaType=function(t){var e=c(t)?t:t.id;return 0<=["area","area-spline","area-step"].indexOf(this.config.data_types[e])},p.isBarType=function(t){var e=c(t)?t:t.id;return"bar"===this.config.data_types[e]},p.isScatterType=function(t){var e=c(t)?t:t.id;return"scatter"===this.config.data_types[e]},p.isPieType=function(t){var e=c(t)?t:t.id;return"pie"===this.config.data_types[e]},p.isGaugeType=function(t){var e=c(t)?t:t.id;return"gauge"===this.config.data_types[e]},p.isDonutType=function(t){var e=c(t)?t:t.id;return"donut"===this.config.data_types[e]},p.isArcType=function(t){return this.isPieType(t)||this.isDonutType(t)||this.isGaugeType(t)},p.lineData=function(t){return this.isLineType(t)?[t]:[]},p.arcData=function(t){return this.isArcType(t.data)?[t]:[]},p.barData=function(t){return this.isBarType(t)?t.values:[]},p.lineOrScatterData=function(t){return this.isLineType(t)||this.isScatterType(t)?t.values:[]},p.barOrLineData=function(t){return this.isBarType(t)||this.isLineType(t)?t.values:[]},p.isInterpolationType=function(t){return 0<=["linear","linear-closed","basis","basis-open","basis-closed","bundle","cardinal","cardinal-open","cardinal-closed","monotone"].indexOf(t)},p.isSafari=function(){var t=window.navigator.userAgent;return 0<=t.indexOf("Safari")&&t.indexOf("Chrome")<0},p.isChrome=function(){return 0<=window.navigator.userAgent.indexOf("Chrome")},p.initZoom=function(){var e,i=this,n=i.d3,a=i.config;i.zoom=n.behavior.zoom().on("zoomstart",function(){e=n.event.sourceEvent,i.zoom.altDomain=n.event.sourceEvent.altKey?i.x.orgDomain():null,a.zoom_onzoomstart.call(i.api,n.event.sourceEvent)}).on("zoom",function(){i.redrawForZoom.call(i)}).on("zoomend",function(){var t=n.event.sourceEvent;t&&e.clientX===t.clientX&&e.clientY===t.clientY||(i.redrawEventRect(),i.updateZoom(),a.zoom_onzoomend.call(i.api,i.x.orgDomain()))}),i.zoom.scale=function(t){return a.axis_rotated?this.y(t):this.x(t)},i.zoom.orgScaleExtent=function(){var t=a.zoom_extent?a.zoom_extent:[1,10];return[t[0],Math.max(i.getMaxDataCount()/t[1],t[1])]},i.zoom.updateScaleExtent=function(){var t=D(i.x.orgDomain())/D(i.getZoomDomain()),e=this.orgScaleExtent();return this.scaleExtent([e[0]*t,e[1]*t]),this}},p.getZoomDomain=function(){var t=this.config,e=this.d3;return[e.min([this.orgXDomain[0],t.zoom_x_min]),e.max([this.orgXDomain[1],t.zoom_x_max])]},p.updateZoom=function(){var t=this.config.zoom_enabled?this.zoom:function(){};this.main.select("."+H.zoomRect).call(t).on("dblclick.zoom",null),this.main.selectAll("."+H.eventRect).call(t).on("dblclick.zoom",null)},p.redrawForZoom=function(){var t=this,e=t.d3,i=t.config,n=t.zoom,a=t.x;if(i.zoom_enabled&&0!==t.filterTargetsToShow(t.data.targets).length){if("mousemove"===e.event.sourceEvent.type&&n.altDomain)return a.domain(n.altDomain),void n.scale(a).updateScaleExtent();t.isCategorized()&&a.orgDomain()[0]===t.orgXDomain[0]&&a.domain([t.orgXDomain[0]-1e-10,a.orgDomain()[1]]),t.redraw({withTransition:!1,withY:i.zoom_rescale,withSubchart:!1,withEventRect:!1,withDimension:!1}),"mousemove"===e.event.sourceEvent.type&&(t.cancelClick=!0),i.zoom_onzoom.call(t.api,a.orgDomain())}},x});