!function(a){"use strict";function b(a){var b=this.internal=new c(this);b.loadConfig(a),b.init(),function d(a,b,c){for(var e in a)b[e]=a[e].bind(c),Object.keys(a[e]).length>0&&d(a[e],b[e],c)}(e,this,this)}function c(b){var c=this;c.d3=a.d3?a.d3:"undefined"!=typeof require?require("d3"):void 0,c.api=b,c.config=c.getDefaultConfig(),c.data={},c.cache={},c.axes={}}function d(a,b){function c(a,b){a.attr("transform",function(a){return"translate("+Math.ceil(b(a)+s)+", 0)"})}function d(a,b){a.attr("transform",function(a){return"translate(0,"+Math.ceil(b(a))+")"})}function e(a){var b=a[0],c=a[a.length-1];return c>b?[b,c]:[c,b]}function f(a){var b,c,d=[];if(a.ticks)return a.ticks.apply(a,k);for(c=a.domain(),b=Math.ceil(c[0]);b0&&d[0]>0&&d.unshift(d[0]-(d[1]-d[0])),d}function g(){var a,c=m.copy();return b&&(a=m.domain(),c.domain([a[0],a[1]-1])),c}function h(a){return j?j(a):a}function i(i){i.each(function(){function i(a){var b=m(a)+s;return B[0]=0&&M.select(this).style("display",b%J?"none":"block")})}else K.svg.selectAll("."+pe[_d]+" .tick text").style("display","block");!N[vb]&&N[Hb]&&K.rotateTickText(K.axes.x,b.axisX,N[Hb]),w=K.generateDrawArea(O,!1),y=K.generateDrawBar(P),A=K.generateDrawLine(Q,!1),B=K.generateXYForText(P,!0),C=K.generateXYForText(P,!1),K.subY.domain(K.y.domain()),K.subY2.domain(K.y2.domain()),K.tooltip.style("display","none"),K.updateXgridFocus(),L.select("text."+pe[Nd]+"."+pe[Md]).attr("x",K.width/2).attr("y",K.height/2).text(N[fb]).transition().style("opacity",S.length?0:1),K.redrawGrid(D,l),K.redrawRegion(D),f=L.selectAll("."+pe[Fd]).selectAll("."+pe[Ed]).data(De(K.barData,K)),f.enter().append("path").attr("class",De(K.classBar,K)).style("stroke",function(a){return K.color(a.id)}).style("fill",function(a){return K.color(a.id)}),f.style("opacity",De(K.initialOpacity,K)),f.exit().transition().duration(E).style("opacity",0).remove(),c=L.selectAll("."+pe[Dd]).selectAll("."+pe[Cd]).data(De(K.lineData,K)),c.enter().append("path").attr("class",De(K.classLine,K)).style("stroke",K.color),c.style("opacity",De(K.initialOpacity,K)).attr("transform",null),c.exit().transition().duration(E).style("opacity",0).remove(),d=L.selectAll("."+pe[Ld]).selectAll("."+pe[Kd]).data(De(K.lineData,K)),d.enter().append("path").attr("class",De(K.classArea,K)).style("fill",K.color).style("opacity",function(){return K.orgAreaOpacity=+M.select(this).style("opacity"),0}),d.style("opacity",K.orgAreaOpacity),d.exit().transition().duration(E).style("opacity",0).remove(),N[mc]&&(e=L.selectAll("."+pe[Hd]).selectAll("."+pe[Gd]).data(De(K.lineOrScatterData,K)),e.enter().append("circle").attr("class",De(K.classCircle,K)).attr("r",De(K.pointR,K)).style("fill",K.color),e.style("opacity",De(K.initialOpacity,K)),e.exit().remove()),K.hasDataLabel()&&K.redrawText(E),K.redrawArc&&K.redrawArc(D,E,r),K.redrawSubchart&&K.redrawSubchart(m,b,D,E,O,P,Q),L.selectAll("."+pe[od]).filter(De(K.isBarType,K)).selectAll("circle").remove(),N[s]&&(g=L.select("."+pe[qd]).style("cursor",N[o]?N[vb]?"ns-resize":"ew-resize":null),ze(N[z])&&!K.isSingleX(N[z])?(g.classed(pe[sd])||g.classed(pe[sd],!0).classed(pe[rd],!1).selectAll("."+pe[pd]).remove(),h=L.select("."+pe[qd]).selectAll("."+pe[pd]).data([0]),K.generateEventRectsForMultipleXs(h.enter()),h.attr("x",0).attr("y",0).attr("width",K.width).attr("height",K.height)):(g.classed(pe[rd])||g.classed(pe[sd],!1).classed(pe[rd],!0).selectAll("."+pe[pd]).remove(),!K.isCustomX()&&!K.isTimeSeries()||K.isCategorized()?(k=K.getEventRectWidth(),j=function(a){return K.x(a.x)-k/2}):(k=function(a){var b=K.getPrevX(a.index),c=K.getNextX(a.index),d=K.data.xs[a.id][a.index],e=(K.x(c?c:d)-K.x(b?b:d))/2;return 0>e?0:e},j=function(a){var b=K.getPrevX(a.index),c=K.data.xs[a.id][a.index];return(K.x(c)+K.x(b?b:c))/2}),i=K.getMaxDataCountTarget(K.data.targets),L.select("."+pe[qd]).datum(i?i.values:[]),h=L.select("."+pe[qd]).selectAll("."+pe[pd]).data(function(a){return a}),K.generateEventRectsForSingleX(h.enter()),h.attr("class",De(K.classEvent,K)).attr("x",N[vb]?0:j).attr("y",N[vb]?j:0).attr("width",N[vb]?K.width:k).attr("height",N[vb]?k:K.height),h.exit().remove())),M.transition().duration(D).each(function(){var b=[];b.push(f.transition().attr("d",y).style("fill",K.color).style("opacity",1)),b.push(c.transition().attr("d",A).style("stroke",K.color).style("opacity",1)),b.push(d.transition().attr("d",w).style("fill",K.color).style("opacity",K.orgAreaOpacity)),b.push(e.transition().style("opacity",De(K.opacityForCircle,K)).style("fill",K.color).attr("cx",U).attr("cy",V)),b.push(L.selectAll("."+pe[nd]).transition().attr("cx",U).attr("cy",V)),K.addTransitionForText(b,B,C,a.flow),K.addTransitionForRegion(b),K.addTransitionForGrid(b),a.flow&&(G=K.generateWait(),b.forEach(function(a){G.add(a)}))}).call(G?G:function(){},function(){var b,g,i,l=1,m=a.flow.index,n=a.flow.length,o=K.getValueOnIndex(K.data.targets[0].values,m),p=K.getValueOnIndex(K.data.targets[0].values,m+n),q=K.x.domain(),r=a.flow.duration||D,s=a.flow.done||function(){},t=K.generateWait(),u=K.xgrid||M.selectAll([]),v=K.xgridLines||M.selectAll([]),x=K.mainRegion||M.selectAll([]),z=K.mainText||M.selectAll([]);K.data.targets.forEach(function(a){a.values.splice(0,n)}),i=K.updateXDomain(S,!0,!0),K.updateXGrid&&K.updateXGrid(!0),a.flow.orgDataCount?b=1===a.flow.orgDataCount||o.x===p.x?K.x(q[0])-K.x(i[0]):K.isTimeSeries()?K.x(q[0])-K.x(i[0]):K.x(o.x)-K.x(p.x):1!==K.data.targets[0].values.length?b=K.x(q[0])-K.x(i[0]):K.isTimeSeries()?(o=K.getValueOnIndex(K.data.targets[0].values,0),p=K.getValueOnIndex(K.data.targets[0].values,K.data.targets[0].values.length-1),b=K.x(o.x)-K.x(p.x)):b=xe(i)/2,l=xe(q)/xe(i),g="translate("+b+",0) scale("+l+",1)",M.transition().ease("linear").duration(r).each(function(){t.add(K.axes.x.transition().call(K.xAxis)),t.add(f.transition().attr("transform",g)),t.add(c.transition().attr("transform",g)),t.add(d.transition().attr("transform",g)),t.add(e.transition().attr("transform",g)),t.add(z.transition().attr("transform",g)),t.add(x.filter(K.isRegionOnX).transition().attr("transform",g)),t.add(u.transition().attr("transform",g)),t.add(v.transition().attr("transform",g))}).call(t,function(){var a,b=[],g=[],i=[];if(n){for(a=0;n>a;a++)b.push("."+pe[Ad]+"-"+(m+a)),g.push("."+pe[Nd]+"-"+(m+a)),i.push("."+pe[pd]+"-"+(m+a));K.svg.selectAll("."+pe[Bd]).selectAll(b).remove(),K.svg.selectAll("."+pe[Od]).selectAll(g).remove(),K.svg.selectAll("."+pe[qd]).selectAll(i).remove(),K.svg.select("."+pe[Rd]).remove()}u.attr("transform",null).attr(K.xgridAttr),v.attr("transform",null),v.select("line").attr("x1",N[vb]?0:T).attr("x2",N[vb]?K.width:T),v.select("text").attr("x",N[vb]?K.width:0).attr("y",T),f.attr("transform",null).attr("d",y),c.attr("transform",null).attr("d",A),d.attr("transform",null).attr("d",w),e.attr("transform",null).attr("cx",U).attr("cy",V),z.attr("transform",null).attr("x",B).attr("y",C).style("fill-opacity",De(K.opacityForText,K)),x.attr("transform",null),x.select("rect").filter(K.isRegionOnX).attr("x",De(K.regionX,K)).attr("width",De(K.regionWidth,K)),h.attr("x",N[vb]?0:j).attr("y",N[vb]?j:0).attr("width",N[vb]?K.width:k).attr("height",N[vb]?k:K.height),s()})}),K.mapToIds(K.data.targets).forEach(function(a){K.withoutFadeIn[a]=!0}),K.updateZoom&&K.updateZoom()},f.updateAndRedraw=function(a){var b,c=this,d=c.config;a=a||{},a.withTransition=Ae(a,"withTransition",!0),a.withTransform=Ae(a,"withTransform",!1),a.withLegend=Ae(a,"withLegend",!1),a.withUpdateXDomain=!0,a.withUpdateOrgXDomain=!0,a.withTransitionForExit=!1,a.withTransitionForTransform=Ae(a,"withTransitionForTransform",a.withTransition),c.updateSizes(),a.withLegend&&d[lb]||(b=c.generateAxisTransitions(a.withTransitionForAxis?d[x]:0),c.updateScales(),c.updateSvgSize(),c.transformAll(a.withTransitionForTransform,b)),c.redraw(a,b)},f.generateEventRectsForSingleX=function(a){var b=this,c=b.d3,d=b.config;a.append("rect").attr("class",De(b.classEvent,b)).style("cursor",d[Q]&&d[R]?"pointer":null).on("mouseover",function(a){var c,e,f=a.index;b.dragging||b.hasArcType()||(c=b.data.targets.map(function(a){return b.addName(b.getValueOnIndex(a.values,f))}),e=[],Object.keys(d[D]).forEach(function(a){for(var b=0;b=0},f.isCustomX=function(){var a=this,b=a.config;return!a.isTimeSeries()&&(b[y]||ze(b[z]))},f.getTranslate=function(a){var b,c,d=this,e=d.config;return"main"===a?(b=we(d.margin.left),c=we(d.margin.top)):"context"===a?(b=we(d.margin2.left),c=we(d.margin2.top)):"legend"===a?(b=d.margin3.left,c=d.margin3.top):"x"===a?(b=0,c=e[vb]?0:d.height):"y"===a?(b=0,c=e[vb]?d.height:0):"y2"===a?(b=e[vb]?0:d.width,c=e[vb]?1:0):"subx"===a?(b=0,c=e[vb]?0:d.height2):"arc"===a&&(b=d.arcWidth/2,c=d.arcHeight/2),"translate("+b+","+c+")"},f.initialOpacity=function(a){return null!==a.value&&this.withoutFadeIn[a.id]?1:0},f.opacityForCircle=function(a){var b=this;return qe(a.value)?b.isScatterType(a)?.5:1:0},f.opacityForText=function(){return this.hasDataLabel()?1:0},f.xx=function(a){return a?this.x(a.x):null},f.xv=function(a){var b=this;return Math.ceil(b.x(b.isTimeSeries()?b.parseDate(a.value):a.value))},f.yv=function(a){var b=this,c=a.axis&&"y2"===a.axis?b.y2:b.y;return Math.ceil(c(a.value))},f.subxx=function(a){return a?this.subX(a.x):null},f.transformMain=function(a,b){var c,d,e,f=this;b&&b.axisX?c=b.axisX:(c=f.main.select("."+pe[_d]),a&&(c=c.transition())),b&&b.axisY?d=b.axisY:(d=f.main.select("."+pe[be]),a&&(d=d.transition())),b&&b.axisY2?e=b.axisY2:(e=f.main.select("."+pe[de]),a&&(e=e.transition())),(a?f.main.transition():f.main).attr("transform",f.getTranslate("main")),c.attr("transform",f.getTranslate("x")),d.attr("transform",f.getTranslate("y")),e.attr("transform",f.getTranslate("y2")),f.main.select("."+pe[hd]).attr("transform",f.getTranslate("arc"))},f.transformAll=function(a,b){var c=this;c.transformMain(a,b),c.config[gb]&&c.transformContext(a,b),c.legend&&c.transformLegend(a)},f.updateSvgSize=function(){var a=this;a.svg.attr("width",a.currentWidth).attr("height",a.currentHeight),a.svg.select("#"+a.clipId).select("rect").attr("width",a.width).attr("height",a.height),a.svg.select("#"+a.clipIdForXAxis).select("rect").attr("x",De(a.getXAxisClipX,a)).attr("y",De(a.getXAxisClipY,a)).attr("width",De(a.getXAxisClipWidth,a)).attr("height",De(a.getXAxisClipHeight,a)),a.svg.select("#"+a.clipIdForYAxis).select("rect").attr("x",De(a.getYAxisClipX,a)).attr("y",De(a.getYAxisClipY,a)).attr("width",De(a.getYAxisClipWidth,a)).attr("height",De(a.getYAxisClipHeight,a)),a.svg.select("."+pe[td]).attr("width",a.width).attr("height",a.height),a.selectChart.style("max-height",a.currentHeight+"px")},f.updateDimension=function(){var a=this;a.config[vb]?(a.axes.x.call(a.xAxis),a.axes.subx.call(a.subXAxis)):(a.axes.y.call(a.yAxis),a.axes.y2.call(a.y2Axis)),a.updateSizes(),a.updateScales(),a.updateSvgSize(),a.transformAll(!1)},f.observeInserted=function(b){var c=this,d=new MutationObserver(function(e){e.forEach(function(e){if("childList"===e.type&&e.previousSibling){d.disconnect();var f=a.setInterval(function(){b.node().parentNode&&(a.clearInterval(f),c.updateDimension(),c.redraw({withTransform:!0,withUpdateXDomain:!0,withUpdateOrgXDomain:!0,withTransition:!1,withTransitionForTransform:!1,withLegend:!0}),b.transition().style("opacity",1))},10)}})});d.observe(b.node(),{attributes:!0,childList:!0,characterData:!0})},f.generateResize=function(){function a(){b.forEach(function(a){a()})}var b=[];return a.add=function(a){b.push(a)},a},f.transformTo=function(a,b,c){var d=this,e=!d.hasArcType(),f=c||{withTransitionForAxis:e};f.withTransitionForTransform=!1,d.transiting=!1,d.setTargetType(a,b),d.updateAndRedraw(f)},f.endall=function(a,b){var c=0;a.each(function(){++c}).each("end",function(){--c||b.apply(this,arguments)})},f.generateWait=function(){var a=[],b=function(b,c){var d=setInterval(function(){var b=0;a.forEach(function(a){if(a.empty())return void(b+=1);try{a.transition()}catch(c){b+=1}}),b===a.length&&(clearInterval(d),c&&c())},10)};return b.add=function(b){a.push(b)},b},f.parseDate=function(b){var c,d=this;return c=b instanceof Date?b:"number"==typeof b?new Date(b):d.dataTimeFormat(d.config[A]).parse(b),(!c||isNaN(+c))&&a.console.error("Failed to parse x '"+b+"' to Date object"),c};var h="bindto",i="size_width",j="size_height",k="padding_left",l="padding_right",m="padding_top",n="padding_bottom",o="zoom_enabled",p="zoom_extent",q="zoom_privileged",r="zoom_onzoom",s="interaction_enabled",t="onmouseover",u="onmouseout",v="onresize",w="onresized",x="transition_duration",y="data_x",z="data_xs",A="data_xFormat",B="data_xLocaltime",C="data_idConverter",D="data_names",E="data_classes",F="data_groups",G="data_axes",H="data_type",I="data_types",J="data_labels",K="data_order",L="data_regions",M="data_color",N="data_colors",O="data_hide",P="data_filter",Q="data_selection_enabled",R="data_selection_grouped",S="data_selection_isselectable",T="data_selection_multiple",U="data_onclick",V="data_onmouseover",W="data_onmouseout",X="data_onselected",Y="data_onunselected",Z="data_ondragstart",$="data_ondragend",_="data_url",ab="data_json",bb="data_rows",cb="data_columns",db="data_mimeType",eb="data_keys",fb="data_empty_label_text",gb="subchart_show",hb="subchart_size_height",ib="subchart_onbrush",jb="color_pattern",kb="color_threshold",lb="legend_show",mb="legend_position",nb="legend_inset_anchor",ob="legend_inset_x",pb="legend_inset_y",qb="legend_inset_step",rb="legend_item_onclick",sb="legend_item_onmouseover",tb="legend_item_onmouseout",ub="legend_equally",vb="axis_rotated",wb="axis_x_show",xb="axis_x_type",yb="axis_x_localtime",zb="axis_x_categories",Ab="axis_x_tick_centered",Bb="axis_x_tick_format",Cb="axis_x_tick_culling",Db="axis_x_tick_culling_max",Eb="axis_x_tick_count",Fb="axis_x_tick_fit",Gb="axis_x_tick_values",Hb="axis_x_tick_rotate",Ib="axis_x_tick_outer",Jb="axis_x_max",Kb="axis_x_min",Lb="axis_x_padding",Mb="axis_x_height",Nb="axis_x_default",Ob="axis_x_label",Pb="axis_y_show",Qb="axis_y_max",Rb="axis_y_min",Sb="axis_y_center",Tb="axis_y_label",Ub="axis_y_tick_format",Vb="axis_y_tick_outer",Wb="axis_y_padding",Xb="axis_y_ticks",Yb="axis_y2_show",Zb="axis_y2_max",$b="axis_y2_min",_b="axis_y2_center",ac="axis_y2_label",bc="axis_y2_tick_format",cc="axis_y2_tick_outer",dc="axis_y2_padding",ec="axis_y2_ticks",fc="grid_x_show",gc="grid_x_type",hc="grid_x_lines",ic="grid_y_show",jc="grid_y_lines",kc="grid_y_ticks",lc="grid_focus_show",mc="point_show",nc="point_r",oc="point_focus_expand_enabled",pc="point_focus_expand_r",qc="point_select_r",rc="line_connect_null",sc="bar_width",tc="bar_width_ratio",uc="bar_width_max",vc="bar_zerobased",wc="area_zerobased",xc="pie_label_show",yc="pie_label_format",zc="pie_label_threshold",Ac="pie_sort",Bc="pie_expand",Cc="gauge_label_show",Dc="gauge_label_format",Ec="gauge_expand",Fc="gauge_min",Gc="gauge_max",Hc="gauge_units",Ic="gauge_width",Jc="donut_label_show",Kc="donut_label_format",Lc="donut_label_threshold",Mc="donut_width",Nc="donut_sort",Oc="donut_expand",Pc="donut_title",Qc="regions",Rc="tooltip_show",Sc="tooltip_grouped",Tc="tooltip_format_title",Uc="tooltip_format_name",Vc="tooltip_format_value",Wc="tooltip_contents",Xc="tooltip_init_show",Yc="tooltip_init_x",Zc="tooltip_init_position";f.getDefaultConfig=function(){var a={};return a[h]="#chart",a[i]=void 0,a[j]=void 0,a[k]=void 0,a[l]=void 0,a[m]=void 0,a[n]=void 0,a[o]=!1,a[p]=void 0,a[q]=!1,a[r]=function(){},a[s]=!0,a[t]=function(){},a[u]=function(){},a[v]=function(){},a[w]=function(){},a[x]=350,a[y]=void 0,a[z]={},a[A]="%Y-%m-%d",a[B]=!0,a[C]=function(a){return a},a[D]={},a[E]={},a[F]=[],a[G]={},a[H]=void 0,a[I]={},a[J]={},a[K]="desc",a[L]={},a[M]=void 0,a[N]={},a[O]=!1,a[P]=void 0,a[Q]=!1,a[R]=!1,a[S]=function(){return!0},a[T]=!0,a[U]=function(){},a[V]=function(){},a[W]=function(){},a[X]=function(){},a[Y]=function(){},a[Z]=function(){},a[$]=function(){},a[_]=void 0,a[ab]=void 0,a[bb]=void 0,a[cb]=void 0,a[db]=void 0,a[eb]=void 0,a[fb]="",a[gb]=!1,a[hb]=60,a[ib]=function(){},a[jb]=[],a[kb]={},a[lb]=!0,a[mb]="bottom",a[nb]="top-left",a[ob]=10,a[pb]=0,a[qb]=void 0,a[rb]=void 0,a[sb]=void 0,a[tb]=void 0,a[ub]=!1,a[vb]=!1,a[wb]=!0,a[xb]="indexed",a[yb]=!0,a[zb]=[],a[Ab]=!1,a[Bb]=void 0,a[Cb]={},a[Db]=10,a[Eb]=void 0,a[Fb]=!0,a[Gb]=null,a[Hb]=void 0,a[Ib]=!0,a[Jb]=null,a[Kb]=null,a[Lb]={},a[Mb]=void 0,a[Nb]=void 0,a[Ob]={},a[Pb]=!0,a[Qb]=void 0,a[Rb]=void 0,a[Sb]=void 0,a[Tb]={},a[Ub]=void 0,a[Vb]=!0,a[Wb]=void 0,a[Xb]=10,a[Yb]=!1,a[Zb]=void 0,a[$b]=void 0,a[_b]=void 0,a[ac]={},a[bc]=void 0,a[cc]=!0,a[dc]=void 0,a[ec]=10,a[fc]=!1,a[gc]="tick",a[hc]=[],a[ic]=!1,a[jc]=[],a[kc]=10,a[lc]=!0,a[mc]=!0,a[nc]=2.5,a[oc]=!0,a[pc]=void 0,a[qc]=void 0,a[rc]=!1,a[sc]=void 0,a[tc]=.6,a[uc]=void 0,a[vc]=!0,a[wc]=!0,a[xc]=!0,a[yc]=void 0,a[zc]=.05,a[Ac]=!0,a[Bc]=!0,a[Cc]=!0,a[Dc]=void 0,a[Ec]=!0,a[Fc]=0,a[Gc]=100,a[Hc]=void 0,a[Ic]=void 0,a[Jc]=!0,a[Kc]=void 0,a[Lc]=.05,a[Mc]=void 0,a[Nc]=!0,a[Oc]=!0,a[Pc]="",a[Qc]=[],a[Rc]=!0,a[Sc]=!0,a[Tc]=void 0,a[Uc]=void 0,a[Vc]=void 0,a[Wc]=function(a,b,c,d){return this.getTooltipContent?this.getTooltipContent(a,b,c,d):""},a[Xc]=!1,a[Yc]=0,a[Zc]={top:"0px",left:"50px"},Object.keys(this.additionalConfig).forEach(function(b){a[b]=this.additionalConfig[b]},this),a},f.additionalConfig={},f.loadConfig=function(a){function b(){var a=d.shift();return a&&c&&"object"==typeof c&&a in c?(c=c[a],b()):a?void 0:c}var c,d,e,f=this.config;Object.keys(f).forEach(function(g){c=a,d=g.split("_"),e=b(),ue(e)&&(f[g]=e)})},f.getScale=function(a,b,c){return(c?this.d3.time.scale():this.d3.scale.linear()).range([a,b])},f.getX=function(a,b,c,d){var e,f=this,g=f.getScale(a,b,f.isTimeSeries()),h=c?g.domain(c):g;f.isCategorized()?(d=d||function(){return 0},g=function(a,b){var c=h(a)+d(a); return b?c:Math.ceil(c)}):g=function(a,b){var c=h(a);return b?c:Math.ceil(c)};for(e in h)g[e]=h[e];return g.orgDomain=function(){return h.domain()},f.isCategorized()&&(g.domain=function(a){return arguments.length?(h.domain(a),g):(a=this.orgDomain(),[a[0],a[1]+1])}),g},f.getY=function(a,b,c){var d=this.getScale(a,b);return c&&d.domain(c),d},f.getYScale=function(a){return"y2"===this.getAxisId(a)?this.y2:this.y},f.getSubYScale=function(a){return"y2"===this.getAxisId(a)?this.subY2:this.subY},f.updateScales=function(){var a=this,b=a.config,c=!a.x;a.xMin=b[vb]?1:0,a.xMax=b[vb]?a.height:a.width,a.yMin=b[vb]?0:a.height,a.yMax=b[vb]?a.width:1,a.subXMin=a.xMin,a.subXMax=a.xMax,a.subYMin=b[vb]?0:a.height2,a.subYMax=b[vb]?a.width2:1,a.x=a.getX(a.xMin,a.xMax,c?void 0:a.x.orgDomain(),function(){return a.xAxis.tickOffset()}),a.y=a.getY(a.yMin,a.yMax,c?void 0:a.y.domain()),a.y2=a.getY(a.yMin,a.yMax,c?void 0:a.y2.domain()),a.subX=a.getX(a.xMin,a.xMax,a.orgXDomain,function(b){return b%1?0:a.subXAxis.tickOffset()}),a.subY=a.getY(a.subYMin,a.subYMax,c?void 0:a.subY.domain()),a.subY2=a.getY(a.subYMin,a.subYMax,c?void 0:a.subY2.domain()),a.xAxisTickFormat=a.getXAxisTickFormat(),a.xAxisTickValues=b[Gb]?b[Gb]:c?void 0:a.xAxis.tickValues(),a.xAxis=a.getXAxis(a.x,a.xOrient,a.xAxisTickFormat,a.xAxisTickValues),a.subXAxis=a.getXAxis(a.subX,a.subXOrient,a.xAxisTickFormat,a.xAxisTickValues),a.yAxis=a.getYAxis(a.y,a.yOrient,b[Ub],b[Xb]),a.y2Axis=a.getYAxis(a.y2,a.y2Orient,b[bc],b[ec]),c||(a.brush&&a.brush.scale(a.subX),b[o]&&a.zoom.scale(a.x)),a.updateArc&&a.updateArc()},f.getYDomainMin=function(a){var b,c,d,e,f,g,h=this,i=h.config,j=h.mapToIds(a),k=h.getValuesAsIdKeyed(a);if(i[F].length>0)for(g=h.hasNegativeValueInTargets(a),b=0;b=0}),0!==e.length)for(d=e[0],g&&k[d]&&k[d].forEach(function(a,b){k[d][b]=0>a?a:0}),c=1;c0||(k[d][b]+=+a)});return h.d3.min(Object.keys(k).map(function(a){return h.d3.min(k[a])}))},f.getYDomainMax=function(a){var b,c,d,e,f,g,h=this,i=h.config,j=h.mapToIds(a),k=h.getValuesAsIdKeyed(a);if(i[F].length>0)for(g=h.hasPositiveValueInTargets(a),b=0;b=0}),0!==e.length)for(d=e[0],g&&k[d]&&k[d].forEach(function(a,b){k[d][b]=a>0?a:0}),c=1;c+a||(k[d][b]+=+a)});return h.d3.max(Object.keys(k).map(function(a){return h.d3.max(k[a])}))},f.getYDomain=function(a,b){var c,d,e,f,g,h,i,j,k,l,m=this,n=m.config,o=a.filter(function(a){return m.getAxisId(a.id)===b}),p="y2"===b?n[$b]:n[Rb],q="y2"===b?n[Zb]:n[Qb],r=qe(p)?p:m.getYDomainMin(o),s=qe(q)?q:m.getYDomainMax(o),t="y2"===b?n[_b]:n[Sb],u=m.hasType("bar",o)&&n[vc]||m.hasType("area",o)&&n[wc],v=m.hasDataLabel()&&n[vb],w=m.hasDataLabel()&&!n[vb];return 0===o.length?"y2"===b?m.y2.domain():m.y.domain():(r===s&&(0>r?s=0:r=0),k=r>=0&&s>=0,l=0>=r&&0>=s,u&&(k&&(r=0),l&&(s=0)),c=Math.abs(s-r),d=e=f=.1*c,t&&(g=Math.max(Math.abs(r),Math.abs(s)),s=g-t,r=t-g),v?(h=m.getDataLabelLength(r,s,b,"width"),i=xe(m.y.range()),j=[h[0]/i,h[1]/i],e+=c*(j[1]/(1-j[0]-j[1])),f+=c*(j[0]/(1-j[0]-j[1]))):w&&(h=m.getDataLabelLength(r,s,b,"height"),e+=h[1],f+=h[0]),"y"===b&&n[Wb]&&(e=m.getAxisPadding(n[Wb],"top",d,c),f=m.getAxisPadding(n[Wb],"bottom",d,c)),"y2"===b&&n[dc]&&(e=m.getAxisPadding(n[dc],"top",d,c),f=m.getAxisPadding(n[dc],"bottom",d,c)),u&&(k&&(f=r),l&&(e=-s)),[r-f,s+e])},f.getXDomainMin=function(a){var b=this,c=b.config;return c[Kb]?b.isTimeSeries()?this.parseDate(c[Kb]):c[Kb]:b.d3.min(a,function(a){return b.d3.min(a.values,function(a){return a.x})})},f.getXDomainMax=function(a){var b=this,c=b.config;return c[Jb]?b.isTimeSeries()?this.parseDate(c[Jb]):c[Jb]:b.d3.max(a,function(a){return b.d3.max(a.values,function(a){return a.x})})},f.getXDomainPadding=function(a){var b,c,d,e,f=this,g=f.config,h=this.getEdgeX(a),i=h[1]-h[0];return f.isCategorized()?c=0:f.hasType("bar",a)?(b=f.getMaxDataCount(),c=b>1?i/(b-1)/2:.5):c=.01*i,"object"==typeof g[Lb]&&ze(g[Lb])?(d=qe(g[Lb].left)?g[Lb].left:c,e=qe(g[Lb].right)?g[Lb].right:c):d=e="number"==typeof g[Lb]?g[Lb]:c,{left:d,right:e}},f.getXDomain=function(a){var b=this,c=[b.getXDomainMin(a),b.getXDomainMax(a)],d=c[0],e=c[1],f=b.getXDomainPadding(a),g=0,h=0;return d-e!==0||b.isCategorized()||(d=b.isTimeSeries()?new Date(.5*d.getTime()):-.5,e=b.isTimeSeries()?new Date(1.5*e.getTime()):.5),(d||0===d)&&(g=b.isTimeSeries()?new Date(d.getTime()-f.left):d-f.left),(e||0===e)&&(h=b.isTimeSeries()?new Date(e.getTime()+f.right):e+f.right),[g,h]},f.updateXDomain=function(a,b,c,d){var e=this,f=e.config;return c&&(e.x.domain(d?d:e.d3.extent(e.getXDomain(a))),e.orgXDomain=e.x.domain(),f[o]&&e.zoom.scale(e.x).updateScaleExtent(),e.subX.domain(e.x.domain()),e.brush&&e.brush.scale(e.subX)),b&&(e.x.domain(d?d:!e.brush||e.brush.empty()?e.orgXDomain:e.brush.extent()),f[o]&&e.zoom.scale(e.x).updateScaleExtent()),e.x.domain()},f.isX=function(a){var b=this,c=b.config;return c[y]&&a===c[y]||ze(c[z])&&Be(c[z],a)},f.isNotX=function(a){return!this.isX(a)},f.getXKey=function(a){var b=this,c=b.config;return c[y]?c[y]:ze(c[z])?c[z][a]:null},f.getXValuesOfXKey=function(a,b){var c,d=this,e=b&&ze(b)?d.mapToIds(b):[];return e.forEach(function(b){d.getXKey(b)===a&&(c=d.data.xs[b])}),c},f.getXValue=function(a,b){var c=this;return a in c.data.xs&&c.data.xs[a]&&qe(c.data.xs[a][b])?c.data.xs[a][b]:b},f.getOtherTargetXs=function(){var a=this,b=Object.keys(a.data.xs);return b.length?a.data.xs[b[0]]:null},f.getOtherTargetX=function(a){var b=this.getOtherTargetXs();return b&&a1?a.forEach(function(a){a.values.length>d&&(b=a,d=a.values.length)}):b=c?a[0]:null,b},f.getEdgeX=function(a){var b,c,d=this.getMaxDataCountTarget(a);return d?(b=d.values[0],c=d.values[d.values.length-1],[b.x,c.x]):[0,0]},f.mapToIds=function(a){return a.map(function(a){return a.id})},f.mapToTargetIds=function(a){var b=this;return a?se(a)?[a]:a:b.mapToIds(b.data.targets)},f.hasTarget=function(a,b){var c,d=this.mapToIds(a);for(c=0;ca})},f.hasPositiveValueInTargets=function(a){return this.checkValueInTargets(a,function(a){return a>0})},f.isOrderDesc=function(){var a=this.config;return a[K]&&"desc"===a[K].toLowerCase()},f.isOrderAsc=function(){var a=this.config;return a[K]&&"asc"===a[K].toLowerCase()},f.orderTargets=function(a){var b=this,c=b.config,d=b.isOrderAsc(),e=b.isOrderDesc();return d||e?a.sort(function(a,b){var c=function(a,b){return a+Math.abs(b.value)},e=a.values.reduce(c,0),f=b.values.reduce(c,0);return d?f-e:e-f}):re(c[K])&&a.sort(c[K]),a},f.filterSameX=function(a,b){return this.d3.merge(a.map(function(a){return a.values})).filter(function(a){return a.x-b===0})},f.filterRemoveNull=function(a){return a.filter(function(a){return qe(a.value)})},f.hasDataLabel=function(){var a=this.config;return"boolean"==typeof a[J]&&a[J]?!0:"object"==typeof a[J]&&ze(a[J])?!0:!1},f.getDataLabelLength=function(a,b,c,d){var e=this,f=[0,0],g=1.3;return e.selectChart.select("svg").selectAll(".dummy").data([a,b]).enter().append("text").text(function(a){return e.formatByAxisId(c)(a)}).each(function(a,b){f[b]=this.getBoundingClientRect()[d]*g}).remove(),f},f.isNoneArc=function(a){return this.hasTarget(this.data.targets,a.id)},f.isArc=function(a){return"data"in a&&this.hasTarget(this.data.targets,a.data.id)},f.findSameXOfValues=function(a,b){var c,d=a[b].x,e=[];for(c=b-1;c>=0&&d===a[c].x;c--)e.push(a[c]);for(c=b;c0?h=i:g=i,h-g===1||0===g&&0===h?(e=[],(a[g].x||0===a[g].x)&&(e=e.concat(f.findSameXOfValues(a,g))),(a[h].x||0===a[h].x)&&(e=e.concat(f.findSameXOfValues(a,h))),f.findClosest(e,b)):f.findClosestOfValues(a,b,g,h)},f.findClosestFromTargets=function(a,b){var c,d=this;return c=a.map(function(a){return d.findClosestOfValues(a.values,b)}),d.findClosest(c,b)},f.findClosest=function(a,b){var c,d,e=this;return a.forEach(function(a){var f=e.dist(a,b);(c>f||!c)&&(c=f,d=a)}),d},f.dist=function(a,b){var c=this,d=c.config,e="y"===c.getAxisId(a.id)?c.y:c.y2,f=d[vb]?1:0,g=d[vb]?0:1;return Math.pow(c.x(a.x)-b[f],2)+Math.pow(e(a.value)-b[g],2)},f.convertUrlToData=function(a,b,c,d){var e=this,f=b?b:"csv";e.d3.xhr(a,function(a,b){var g;g="json"===f?e.convertJsonToData(JSON.parse(b.response),c):e.convertCsvToData(b.response),d.call(e,g)})},f.convertCsvToData=function(a){var b,c=this.d3,d=c.csv.parseRows(a);return 1===d.length?(b=[{}],d[0].forEach(function(a){b[0][a]=null})):b=c.csv.parse(a),b},f.convertJsonToData=function(a,b){var c,d,e=this,f=[];return b?(c=b.value,b.x&&(c.push(b.x),e.config[y]=b.x),f.push(c),a.forEach(function(a){var b=[];c.forEach(function(c){var d=te(a[c])?null:a[c];b.push(d)}),f.push(b)}),d=e.convertRowsToData(f)):(Object.keys(a).forEach(function(b){f.push([b].concat(a[b]))}),d=e.convertColumnsToData(f)),d},f.convertRowsToData=function(a){var b,c,d=a[0],e={},f=[];for(b=1;b=0?d.data.xs[c]=(b&&d.data.xs[c]?d.data.xs[c]:[]).concat(a.map(function(a){return a[f]}).filter(qe).map(function(a,b){return d.generateTargetX(a,c,b)})):e[y]?d.data.xs[c]=d.getOtherTargetXs():ze(e[z])&&(d.data.xs[c]=d.getXValuesOfXKey(f,d.data.targets)):d.data.xs[c]=a.map(function(a,b){return b})}),f.forEach(function(a){if(!d.data.xs[a])throw new Error('x is not defined for id = "'+a+'".')}),c=f.map(function(b,c){var f=e[C](b);return{id:f,id_org:b,values:a.map(function(a,g){var h=d.getXKey(b),i=a[h],j=d.generateTargetX(i,b,g);return d.isCustomX()&&d.isCategorized()&&0===c&&i&&(0===g&&(e[zb]=[]),e[zb].push(i)),(te(a[b])||d.data.xs[b].length<=g)&&(j=void 0),{x:j,value:null===a[b]||isNaN(a[b])?null:+a[b],id:f}}).filter(function(a){return ue(a.x)})}}),c.forEach(function(a){var b;a.values=a.values.sort(function(a,b){var c=a.x||0===a.x?a.x:1/0,d=b.x||0===b.x?b.x:1/0;return c-d}),b=0,a.values.forEach(function(a){a.index=b++}),d.data.xs[a.id].sort(function(a,b){return a-b})}),e[H]&&d.setTargetType(d.mapToIds(c).filter(function(a){return!(a in e[I])}),e[H]),c.forEach(function(a){d.addCache(a.id_org,a)}),c},f.load=function(a,b){var c=this;a&&(b.filter&&(a=a.filter(b.filter)),(b.type||b.types)&&a.forEach(function(a){c.setTargetType(a.id,b.types?b.types[a.id]:b.type)}),c.data.targets.forEach(function(b){for(var c=0;c0?c:320},f.getCurrentPaddingTop=function(){var a=this.config;return qe(a[m])?a[m]:0},f.getCurrentPaddingBottom=function(){var a=this.config;return qe(a[n])?a[n]:0},f.getCurrentPaddingLeft=function(){var a=this,b=a.config;return qe(b[k])?b[k]:b[vb]?b[wb]?Math.max(ve(a.getAxisWidthByAxisId("x")),40):1:b[Pb]?ve(a.getAxisWidthByAxisId("y")):1},f.getCurrentPaddingRight=function(){var a=this,b=a.config,c=10,d=a.isLegendRight?a.getLegendWidth()+20:0;return qe(b[l])?b[l]+1:b[vb]?c+d:(b[Yb]?ve(a.getAxisWidthByAxisId("y2")):c)+d},f.getParentRectValue=function(a){for(var b,c=this.selectChart.node();c&&"BODY"!==c.tagName&&!(b=c.getBoundingClientRect()[a]);)c=c.parentNode;return b},f.getParentWidth=function(){return this.getParentRectValue("width")},f.getParentHeight=function(){var a=this.selectChart.style("height");return a.indexOf("px")>0?+a.replace("px",""):0},f.getSvgLeft=function(){var a=this,b=a.config,c=b[vb]?pe[_d]:pe[be],d=a.main.select("."+c).node(),e=d?d.getBoundingClientRect():{right:0},f=a.selectChart.node().getBoundingClientRect(),g=a.hasArcType(),h=e.right-f.left-(g?0:a.getCurrentPaddingLeft());return h>0?h:0},f.getAxisWidthByAxisId=function(a){var b=this,c=b.getAxisLabelPositionById(a);return c.isInner?20+b.getMaxTickWidth(a):40+b.getMaxTickWidth(a)},f.getHorizontalAxisHeight=function(a){var b=this,c=b.config;return"x"!==a||c[wb]?"x"===a&&c[Mb]?c[Mb]:"y"!==a||c[Pb]?"y2"!==a||c[Yb]?(b.getAxisLabelPositionById(a).isInner?30:40)+("y2"===a?-10:0):b.rotated_padding_top:!c[lb]||b.isLegendRight||b.isLegendInset?1:10:0},f.getEventRectWidth=function(){var a,b,c,d,e,f,g=this,h=g.getMaxDataCountTarget(g.data.targets);return h?(a=h.values[0],b=h.values[h.values.length-1],c=g.x(b.x)-g.x(a.x),0===c?g.config[vb]?g.height:g.width:(d=g.getMaxDataCount(),e=g.hasType("bar")?(d-(g.isCategorized()?.25:1))/d:1,f=d>1?c*e/(d-1):c,1>f?1:f)):0},f.getShapeIndices=function(a){var b,c,d=this,e=d.config,f={},g=0;return d.filterTargetsToShow(d.data.targets.filter(a,d)).forEach(function(a){for(b=0;b=0&&(j+=h(c.values[g].value)-i)}),j}},f.getInterpolate=function(a){var b=this;return b.isSplineType(a)?"cardinal":b.isStepType(a)?"step-after":"linear"},f.circleX=function(a){return a.x||0===a.x?this.x(a.x):null},f.circleY=function(a,b){var c=this,d=c.getShapeIndices(c.isLineType),e=c.generateGetLinePoint(d);return c.config[F].length>0?e(a,b)[0][1]:c.getYScale(a.id)(a.value)},f.getCircles=function(a,b){var c=this;return(b?c.main.selectAll("."+pe[Hd]+c.getTargetSelectorSuffix(b)):c.main).selectAll("."+pe[Gd]+(qe(a)?"-"+a:""))},f.expandCircles=function(a,b){var c=this;c.getCircles(a,b).classed(pe[me],!0).attr("r",De(c.pointExpandedR,c))},f.unexpandCircles=function(a){var b=this;b.getCircles(a).filter(function(){return b.d3.select(this).classed(pe[me])}).classed(pe[me],!1).attr("r",De(b.pointR,b))},f.pointR=function(a){var b=this,c=b.config;return c[mc]&&!b.isStepType(a)?re(c[nc])?c[nc](a):c[nc]:0},f.pointExpandedR=function(a){var b=this,c=b.config;return c[oc]?c[pc]?c[pc]:1.75*b.pointR(a):b.pointR(a)},f.pointSelectR=function(a){var b=this,c=b.config;return c[qc]?c[qc]:4*b.pointR(a)},f.getBarW=function(a,b){var c=this,d=c.config,e="number"==typeof d[sc]?d[sc]:b?2*a.tickOffset()*d[tc]/b:0;return d[uc]&&e>d[uc]?d[uc]:e},f.getBars=function(a){var b=this;return b.main.selectAll("."+pe[Ed]+(qe(a)?"-"+a:""))},f.expandBars=function(a){var b=this;b.getBars(a).classed(pe[me],!0)},f.unexpandBars=function(a){var b=this;b.getBars(a).classed(pe[me],!1)},f.generateDrawBar=function(a,b){var c=this,d=c.config,e=c.generateGetBarPoints(a,b);return function(a,b){var c=e(a,b),f=d[vb]?1:0,g=d[vb]?0:1,h="M "+c[0][f]+","+c[0][g]+" L"+c[1][f]+","+c[1][g]+" L"+c[2][f]+","+c[2][g]+" L"+c[3][f]+","+c[3][g]+" z";return h}},f.generateGetBarPoints=function(a,b){var c=this,d=a.__max__+1,e=c.getBarW(c.xAxis,d),f=c.getShapeX(e,d,a,!!b),g=c.getShapeY(!!b),h=c.getShapeOffset(c.isBarType,a,!!b),i=b?c.getSubYScale:c.getYScale;return function(a,b){var d=i.call(c,a.id)(0),j=h(a,b)||d,k=f(a),l=g(a);return c.config[vb]&&(0l||a.value<0&&l>d)&&(l=d),[[k,j],[k,l-(d-j)],[k+e,l-(d-j)],[k+e,j]]}},f.generateDrawArea=function(a,b){var c=this,d=c.config,e=c.d3.svg.area(),f=c.generateGetAreaPoint(a,b),g=b?c.getSubYScale:c.getYScale,h=function(a){return(b?c.subxx:c.xx).call(c,a)},i=function(a,b){return d[F].length>0?f(a,b)[0][1]:g.call(c,a.id)(0)},j=function(a,b){return d[F].length>0?f(a,b)[1][1]:g.call(c,a.id)(a.value)};return e=d[vb]?e.x0(i).x1(j).y(h):e.x(h).y0(i).y1(j),d[rc]||(e=e.defined(function(a){return null!==a.value})),function(a){var b,f=d[rc]?c.filterRemoveNull(a.values):a.values,g=0,h=0;return c.isAreaType(a)?b=e.interpolate(c.getInterpolate(a))(f):(f[0]&&(g=c.x(f[0].x),h=c.getYScale(a.id)(f[0].value)),b=d[vb]?"M "+h+" "+g:"M "+g+" "+h),b?b:"M 0 0"}},f.generateDrawLine=function(a,b){var c=this,d=c.config,e=c.d3.svg.line(),f=c.generateGetLinePoint(a,b),g=b?c.getSubYScale:c.getYScale,h=function(a){return(b?c.subxx:c.xx).call(c,a)},i=function(a,b){return d[F].length>0?f(a,b)[0][1]:g.call(c,a.id)(a.value)};return e=d[vb]?e.x(i).y(h):e.x(h).y(i),d[rc]||(e=e.defined(function(a){return null!=a.value})),function(a){var f,h=d[rc]?c.filterRemoveNull(a.values):a.values,i=b?c.x:c.subX,j=g.call(c,a.id),k=0,l=0;return c.isLineType(a)?f=d[L][a.id]?c.lineWithRegions(h,i,j,d[L][a.id]):e.interpolate(c.getInterpolate(a))(h):(h[0]&&(k=i(h[0].x),l=j(h[0].value)),f=d[vb]?"M "+l+" "+k:"M "+k+" "+l),f?f:"M 0 0"}},f.generateXYForText=function(a,b){var c=this,d=c.generateGetBarPoints(a,!1),e=b?c.getXForText:c.getYForText;return function(a,b){return e.call(c,d(a,b),a,this)}},f.getXForText=function(a,b,c){var d,e,f=this,g=c.getBoundingClientRect();return f.config[vb]?(e=f.isBarType(b)?4:6,d=a[2][1]+e*(b.value<0?-1:1)):d=f.hasType("bar")?(a[2][0]+a[0][0])/2:a[0][0],d>f.width?f.width-g.width:d},f.getYForText=function(a,b,c){var d,e=this,f=c.getBoundingClientRect();return d=e.config[vb]?(a[0][0]+a[2][0]+.6*f.height)/2:a[2][1]+(b.value<0?f.height:e.isBarType(b)?-3:-6),dl||a.value<0&&l>e)&&(l=e),[[k,j],[k,l-(e-j)]]}},f.generateGetLinePoint=function(a,b){var c=this,d=c.config,e=a.__max__+1,f=c.getShapeX(0,e,a,!!b),g=c.getShapeY(!!b),h=c.getShapeOffset(c.isLineType,a,!!b),i=b?c.getSubYScale:c.getYScale;return function(a,b){var e=i.call(c,a.id)(0),j=h(a,b)||e,k=f(a),l=g(a);return d[vb]&&(0l||a.value<0&&l>e)&&(l=e),[[k,l-(e-j)]]}},f.lineWithRegions=function(a,b,c,d){var e,f,g,h,i,j,k,l,m,n,o,p,q=this,r=q.config,s=-1,t="M",u=[];if(ue(d))for(e=0;e=f;f+=n)t+=g(a[e-1],a[e],f,m);s=a[e].x}return t},f.isWithinCircle=function(a,b){var c=this.d3,d=c.mouse(a),e=c.select(a),f=1*e.attr("cx"),g=1*e.attr("cy");return Math.sqrt(Math.pow(f-d[0],2)+Math.pow(g-d[1],2))=0||!(b.id in d)&&"line"===a)&&(e=!0)}),e},f.hasArcType=function(a){return this.hasType("pie",a)||this.hasType("donut",a)||this.hasType("gauge",a)},f.isLineType=function(a){var b=this.config,c=se(a)?a:a.id;return!b[I][c]||["line","spline","area","area-spline","step","area-step"].indexOf(b[I][c])>=0},f.isStepType=function(a){var b=se(a)?a:a.id;return["step","area-step"].indexOf(this.config[I][b])>=0},f.isSplineType=function(a){var b=se(a)?a:a.id;return["spline","area-spline"].indexOf(this.config[I][b])>=0},f.isAreaType=function(a){var b=se(a)?a:a.id;return["area","area-spline","area-step"].indexOf(this.config[I][b])>=0},f.isBarType=function(a){var b=se(a)?a:a.id;return"bar"===this.config[I][b]},f.isScatterType=function(a){var b=se(a)?a:a.id;return"scatter"===this.config[I][b]},f.isPieType=function(a){var b=se(a)?a:a.id;return"pie"===this.config[I][b]},f.isGaugeType=function(a){var b=se(a)?a:a.id;return"gauge"===this.config[I][b]},f.isDonutType=function(a){var b=se(a)?a:a.id;return"donut"===this.config[I][b]},f.isArcType=function(a){return this.isPieType(a)||this.isDonutType(a)||this.isGaugeType(a)},f.lineData=function(a){return this.isLineType(a)?[a]:[]},f.arcData=function(a){return this.isArcType(a.data)?[a]:[]},f.barData=function(a){return this.isBarType(a)?a.values:[]},f.lineOrScatterData=function(a){return this.isLineType(a)||this.isScatterType(a)?a.values:[]},f.barOrLineData=function(a){return this.isBarType(a)||this.isLineType(a)?a.values:[]},f.initGrid=function(){var a=this,b=a.config,c=a.CLASS,d=a.d3;a.grid=a.main.append("g").attr("clip-path",a.clipPath).attr("class",c[Qd]),b[fc]&&a.grid.append("g").attr("class",c[Sd]),b[ic]&&a.grid.append("g").attr("class",c[Xd]),a.grid.append("g").attr("class",c[Ud]),a.grid.append("g").attr("class",c[Zd]),b[lc]&&a.grid.append("g").attr("class",c[Vd]).append("line").attr("class",c[Vd]),a.xgrid=d.selectAll([]),a.xgridLines=d.selectAll([])},f.updateXGrid=function(a){var b=this,c=b.config,d=b.CLASS,e=b.d3,f=b.generateGridData(c[gc],b.x),g=b.isCategorized()?b.xAxis.tickOffset():0;b.xgridAttr=c[vb]?{x1:0,x2:b.width,y1:function(a){return b.x(a)-g},y2:function(a){return b.x(a)-g}}:{x1:function(a){return b.x(a)+g},x2:function(a){return b.x(a)+g},y1:0,y2:b.height},b.xgrid=b.main.select("."+d[Sd]).selectAll("."+d[Rd]).data(f),b.xgrid.enter().append("line").attr("class",d[Rd]),a||b.xgrid.attr(b.xgridAttr).style("opacity",function(){return+e.select(this).attr(c[vb]?"y1":"x1")===(c[vb]?b.height:0)?0:1}),b.xgrid.exit().remove()},f.updateYGrid=function(){var a=this,b=a.config,c=a.CLASS;a.ygrid=a.main.select("."+c[Xd]).selectAll("."+c[Wd]).data(a.y.ticks(b[kc])),a.ygrid.enter().append("line").attr("class",c[Wd]),a.ygrid.attr("x1",b[vb]?a.y:0).attr("x2",b[vb]?a.y:a.width).attr("y1",b[vb]?0:a.y).attr("y2",b[vb]?a.height:a.y),a.ygrid.exit().remove(),a.smoothLines(a.ygrid,"grid")},f.redrawGrid=function(a,b){var c,d,e,f=this,g=f.main,h=f.config,i=f.CLASS;g.select("line."+i[Vd]).style("visibility","hidden"),h[fc]&&f.updateXGrid(),f.xgridLines=g.select("."+i[Ud]).selectAll("."+i[Td]).data(h[hc]),c=f.xgridLines.enter().append("g").attr("class",function(a){return i[Td]+(a.class?" "+a.class:"")}),c.append("line").style("opacity",0),c.append("text").attr("text-anchor","end").attr("transform",h[vb]?"":"rotate(-90)").attr("dx",h[vb]?0:-f.margin.top).attr("dy",-5).style("opacity",0),f.xgridLines.exit().transition().duration(a).style("opacity",0).remove(),b&&h[ic]&&f.updateYGrid(),b&&(f.ygridLines=g.select("."+i[Zd]).selectAll("."+i[Yd]).data(h[jc]),d=f.ygridLines.enter().append("g").attr("class",function(a){return i[Yd]+(a.class?" "+a.class:"")}),d.append("line").style("opacity",0),d.append("text").attr("text-anchor","end").attr("transform",h[vb]?"rotate(-90)":"").attr("dx",h[vb]?0:-f.margin.top).attr("dy",-5).style("opacity",0),e=De(f.yv,f),f.ygridLines.select("line").transition().duration(a).attr("x1",h[vb]?e:0).attr("x2",h[vb]?e:f.width).attr("y1",h[vb]?0:e).attr("y2",h[vb]?f.height:e).style("opacity",1),f.ygridLines.select("text").transition().duration(a).attr("x",h[vb]?0:f.width).attr("y",e).text(function(a){return a.text}).style("opacity",1),f.ygridLines.exit().transition().duration(a).style("opacity",0).remove())},f.addTransitionForGrid=function(a){var b=this,c=b.config,d=De(b.xv,b);a.push(b.xgridLines.select("line").transition().attr("x1",c[vb]?0:d).attr("x2",c[vb]?b.width:d).attr("y1",c[vb]?d:b.margin.top).attr("y2",c[vb]?d:b.height).style("opacity",1)),a.push(b.xgridLines.select("text").transition().attr("x",c[vb]?b.width:0).attr("y",d).text(function(a){return a.text}).style("opacity",1))},f.showXGridFocus=function(a){var b=this,c=b.config,d=a.filter(function(a){return a&&qe(a.value)});if(c[Rc]&&!b.hasType("scatter")&&!b.hasArcType()){var e=b.main.selectAll("line."+pe[Vd]);e.style("visibility","visible").data([d[0]]).attr(c[vb]?"y1":"x1",De(b.xx,b)).attr(c[vb]?"y2":"x2",De(b.xx,b)),b.smoothLines(e,"grid")}},f.hideXGridFocus=function(){this.main.select("line."+pe[Vd]).style("visibility","hidden")},f.updateXgridFocus=function(){var a=this,b=a.config;a.main.select("line."+pe[Vd]).attr("x1",b[vb]?0:-10).attr("x2",b[vb]?a.width:-10).attr("y1",b[vb]?-10:0).attr("y2",b[vb]?-10:a.height)},f.generateGridData=function(a,b){var c,d,e,f,g=this,h=[],i=g.main.select("."+pe[_d]).selectAll(".tick").size();if("year"===a)for(c=g.getXDomain(),d=c[0].getFullYear(),e=c[1].getFullYear(),f=d;e>=f;f++)h.push(new Date(f+"-01-01 00:00:00"));else h=b.ticks(10),h.length>i&&(h=h.filter(function(a){return(""+a).indexOf(".")<0}));return h},f.getGridFilterToRemove=function(a){return a?function(b){var c=!1;return[].concat(a).forEach(function(d){("value"in d&&b.value===a.value||"class"in d&&b.class===a.class)&&(c=!0)}),c}:function(){return!0}},f.removeGridLines=function(a,b){var c=this,d=c.config,e=c.getGridFilterToRemove(a),f=function(a){return!e(a)},g=b?pe[Ud]:pe[Zd],h=b?pe[Td]:pe.ygridLine;c.main.select("."+g).selectAll("."+h).filter(e).transition().duration(d[x]).style("opacity",0).remove(),b?d[hc]=d[hc].filter(f):d[jc]=d[jc].filter(f)},f.initTooltip=function(){var a,b=this,c=b.config;if(b.tooltip=b.selectChart.style("position","relative").append("div").style("position","absolute").style("pointer-events","none").style("z-index","10").style("display","none"),c[Xc]){if(b.isTimeSeries()&&se(c[Yc])){for(c[Yc]=b.parseDate(c[Yc]),a=0;a"+(g||0===g?""+g+"":"")),i=n(a[f].name),h=o(a[f].value,a[f].ratio,a[f].id,a[f].index),j=k.levelColor?k.levelColor(a[f].value):d(a[f].id),e+="",e+=""+i+"",e+=""+h+"",e+="");return e+""},f.showTooltip=function(a,b){var c,d,e,f,g,h,i,j=this,k=j.config,l=j.hasArcType(),m=a.filter(function(a){return a&&qe(a.value)});0!==m.length&&k[Rc]&&(j.tooltip.html(k[Wc].call(j,a,j.getXAxisTickFormat(),j.getYFormat(l),j.color)).style("display","block"),c=j.tooltip.property("offsetWidth"),d=j.tooltip.property("offsetHeight"),l?(f=j.width/2+b[0],h=j.height/2+b[1]+20):(k[vb]?(e=j.getSvgLeft(),f=e+b[0]+100,g=f+c,i=j.getCurrentWidth()-j.getCurrentPaddingRight(),h=j.x(m[0].x)+20):(e=j.getSvgLeft(),f=e+j.getCurrentPaddingLeft()+j.x(m[0].x)+20,g=f+c,i=e+j.getCurrentWidth()-j.getCurrentPaddingRight(),h=b[1]+15),g>i&&(f-=g-i),h+d>j.getCurrentHeight()&&h>d+30&&(h-=d+30)),j.tooltip.style("top",h+"px").style("left",f+"px"))},f.hideTooltip=function(){this.tooltip.style("display","none")},f.initLegend=function(){var a=this;a.legend=a.svg.append("g").attr("transform",a.getTranslate("legend")),a.config[lb]||(a.legend.style("visibility","hidden"),a.hiddenLegendIds=a.mapToIds(a.data.targets)),a.updateLegend(a.mapToIds(a.data.targets),{withTransform:!1,withTransitionForTransform:!1,withTransition:!1})},f.updateSizeForLegend=function(a,b){var c=this,d=c.config,e={top:c.isLegendTop?c.getCurrentPaddingTop()+d[pb]+5.5:c.currentHeight-a-c.getCurrentPaddingBottom()-d[pb],left:c.isLegendLeft?c.getCurrentPaddingLeft()+d[ob]+.5:c.currentWidth-b-c.getCurrentPaddingRight()-d[ob]+.5};c.margin3={top:c.isLegendRight?0:c.isLegendInset?e.top:c.currentHeight-a,right:0/0,bottom:0,left:c.isLegendRight?c.currentWidth-b:c.isLegendInset?e.left:0}},f.transformLegend=function(a){var b=this;(a?b.legend.transition():b.legend).attr("transform",b.getTranslate("legend"))},f.updateLegendStep=function(a){this.legendStep=a},f.updateLegendItemWidth=function(a){this.legendItemWidth=a},f.updateLegendItemHeight=function(a){this.legendItemHeight=a},f.getLegendWidth=function(){var a=this;return a.config[lb]?a.isLegendRight||a.isLegendInset?a.legendItemWidth*(a.legendStep+1):a.currentWidth:0},f.getLegendHeight=function(){var a=this,b=a.config,c=0;return b[lb]&&(c=a.isLegendRight?a.currentHeight:a.isLegendInset?b[qb]?Math.max(20,a.legendItemHeight)*(b[qb]+1):a.height:Math.max(20,a.legendItemHeight)*(a.legendStep+1)),c},f.opacityForLegend=function(a){var b=this;return a.classed(pe[je])?b.legendOpacityForHidden:1},f.opacityForUnfocusedLegend=function(a){var b=this;return a.classed(pe[je])?b.legendOpacityForHidden:.3},f.toggleFocusLegend=function(a,b){var c=this;c.legend.selectAll("."+pe[ge]).transition().duration(100).style("opacity",function(d){var e=c.d3.select(this);return a&&d!==a?b?c.opacityForUnfocusedLegend(e):c.opacityForLegend(e):b?c.opacityForLegend(e):c.opacityForUnfocusedLegend(e)})},f.revertLegend=function(){var a=this,b=a.d3;a.legend.selectAll("."+pe[ge]).transition().duration(100).style("opacity",function(){return a.opacityForLegend(b.select(this))})},f.showLegend=function(a){var b=this,c=b.config;c[lb]||(c[lb]=!0,b.legend.style("visibility","visible")),b.removeHiddenLegendIds(a),b.legend.selectAll(b.selectorLegends(a)).style("visibility","visible").transition().style("opacity",function(){return b.opacityForLegend(b.d3.select(this))})},f.hideLegend=function(a){var b=this,c=b.config;c[lb]&&ye(a)&&(c[lb]=!1,b.legend.style("visibility","hidden")),b.addHiddenLegendIds(a),b.legend.selectAll(b.selectorLegends(a)).style("opacity",0).style("visibility","hidden")},f.updateLegend=function(a,b,c){function d(b,c,d){function e(a,b){b||(f=(l-x-k)/2,w>f&&(f=(l-k)/2,x=0,E++)),C[a]=E,B[E]=q.isLegendInset?10:f,y[a]=x,x+=k}var f,g,h=q.getTextRect(b.textContent,pe[ge]),i=10*Math.ceil((h.width+t)/10),j=10*Math.ceil((h.height+s)/10),k=q.isLegendRight||q.isLegendInset?j:i,l=q.isLegendRight||q.isLegendInset?q.getLegendHeight():q.getLegendWidth();return d&&(x=0,E=0,u=0,v=0),r[lb]&&!q.isLegendToShow(c)?void(z[c]=A[c]=C[c]=y[c]=0):(z[c]=i,A[c]=j,(!u||i>=u)&&(u=i),(!v||j>=v)&&(v=j),g=q.isLegendRight||q.isLegendInset?v:u,void(r[ub]?(Object.keys(z).forEach(function(a){z[a]=u}),Object.keys(A).forEach(function(a){A[a]=v}),f=(l-g*a.length)/2,w>f?(x=0,E=0,a.forEach(function(a){e(a)})):e(c,!0)):e(c)))}var e,f,g,h,i,j,k,l,m,n,o,p,q=this,r=q.config,s=4,t=36,u=0,v=0,w=10,x=0,y={},z={},A={},B=[0],C={},E=0,F=q.legend.selectAll("."+pe[ke]).size();b=b||{},l=Ae(b,"withTransition",!0),m=Ae(b,"withTransitionForTransform",!0),q.isLegendRight?(e=function(a){return u*C[a]},h=function(a){return B[C[a]]+y[a]}):q.isLegendInset?(e=function(a){return u*C[a]+10},h=function(a){return B[C[a]]+y[a]}):(e=function(a){return B[C[a]]+y[a]},h=function(a){return v*C[a]}),f=function(a,b){return e(a,b)+14},i=function(a,b){return h(a,b)+9},g=function(a,b){return e(a,b)-4},j=function(a,b){return h(a,b)-7},k=q.legend.selectAll("."+pe[ge]).data(a).enter().append("g").attr("class",function(a){return q.generateClass(pe[ge],a)}).style("visibility",function(a){return q.isLegendToShow(a)?"visible":"hidden"}).style("cursor","pointer").on("click",function(a){r[rb]?r[rb].call(q,a):q.api.toggle(a)}).on("mouseover",function(a){q.d3.select(this).classed(pe[ke],!0),q.transiting||q.api.focus(a),r[sb]&&r[sb].call(q,a)}).on("mouseout",function(a){q.d3.select(this).classed(pe[ke],!1),q.transiting||q.api.revert(),r[tb]&&r[tb].call(q,a)}),k.append("text").text(function(a){return ue(r[D][a])?r[D][a]:a}).each(function(a,b){d(this,a,0===b)}).style("pointer-events","none").attr("x",q.isLegendRight||q.isLegendInset?f:-200).attr("y",q.isLegendRight||q.isLegendInset?-200:i),k.append("rect").attr("class",pe[he]).style("fill-opacity",0).attr("x",q.isLegendRight||q.isLegendInset?g:-200).attr("y",q.isLegendRight||q.isLegendInset?-200:j),k.append("rect").attr("class",pe[ie]).style("pointer-events","none").style("fill",q.color).attr("x",q.isLegendRight||q.isLegendInset?f:-200).attr("y",q.isLegendRight||q.isLegendInset?-200:h).attr("width",10).attr("height",10),q.isLegendInset&&0!==u&&q.legend.insert("g","."+pe[ge]).attr("class",pe[fe]).append("rect").attr("height",q.getLegendHeight()-10).attr("width",u*(E+1)+10),n=q.legend.selectAll("text").data(a).text(function(a){return ue(r[D][a])?r[D][a]:a}).each(function(a,b){d(this,a,0===b)}),(l?n.transition():n).attr("x",f).attr("y",i),o=q.legend.selectAll("rect."+pe[he]).data(a),(l?o.transition():o).attr("width",function(a){return z[a]}).attr("height",function(a){return A[a]}).attr("x",g).attr("y",j),p=q.legend.selectAll("rect."+pe[ie]).data(a),(l?p.transition():p).style("fill",q.color).attr("x",e).attr("y",h),q.legend.selectAll("."+pe[ge]).classed(pe[je],function(a){return!q.isTargetToShow(a)}).transition().style("opacity",function(a){var b=q.d3.select(this);return q.isTargetToShow(a)?!F||b.classed(pe[ke])?q.opacityForLegend(b):q.opacityForUnfocusedLegend(b):q.legendOpacityForHidden}),q.updateLegendItemWidth(u),q.updateLegendItemHeight(v),q.updateLegendStep(E),q.updateSizes(),q.updateScales(),q.updateSvgSize(),q.transformAll(m,c)},f.initAxis=function(){var a=this,b=a.config,c=a.main,d=a.CLASS;a.axes.x=c.append("g").attr("class",d[$d]+" "+d[_d]).attr("clip-path",a.clipPathForXAxis).attr("transform",a.getTranslate("x")).style("visibility",b[wb]?"visible":"hidden"),a.axes.x.append("text").attr("class",d[ae]).attr("transform",b[vb]?"rotate(-90)":"").style("text-anchor",De(a.textAnchorForXAxisLabel,a)),a.axes.y=c.append("g").attr("class",d[$d]+" "+d[be]).attr("clip-path",a.clipPathForYAxis).attr("transform",a.getTranslate("y")).style("visibility",b[Pb]?"visible":"hidden"),a.axes.y.append("text").attr("class",d[ce]).attr("transform",b[vb]?"":"rotate(-90)").style("text-anchor",De(a.textAnchorForYAxisLabel,a)),a.axes.y2=c.append("g").attr("class",d[$d]+" "+d[de]).attr("transform",a.getTranslate("y2")).style("visibility",b[Yb]?"visible":"hidden"),a.axes.y2.append("text").attr("class",d[ee]).attr("transform",b[vb]?"":"rotate(-90)").style("text-anchor",De(a.textAnchorForY2AxisLabel,a))},f.getXAxis=function(a,b,c,e){var f=this,g=f.config,h=d(f.d3,f.isCategorized()).scale(a).orient(b);return h.tickFormat(c).tickValues(e),f.isCategorized()?(h.tickCentered(g[Ab]),ye(g[Cb])&&(g[Cb]=!1)):h.tickOffset=function(){var a=f.getEdgeX(f.data.targets),b=f.x(a[1])-f.x(a[0]),c=b?b:g[vb]?f.height:f.width;return c/f.getMaxDataCount()/2},h},f.getYAxis=function(a,b,c,e){return d(this.d3).scale(a).orient(b).tickFormat(c).ticks(e)},f.getAxisId=function(a){var b=this.config;return a in b[G]?b[G][a]:"y"},f.getXAxisTickFormat=function(){var a=this,b=a.config,c=a.isTimeSeries()?a.defaultAxisTimeFormat:a.isCategorized()?a.categoryName:function(a){return 0>a?a.toFixed(0):a};return b[Bb]&&(b[Bb]?c=b[Bb]:a.isTimeSeries()&&(c=function(c){return c?a.axisTimeFormat(b[Bb])(c):""})),function(b){return c.call(a,b)}},f.getAxisLabelOptionByAxisId=function(a){var b,c=this,d=c.config;return"y"===a?b=d[Tb]:"y2"===a?b=d[ac]:"x"===a&&(b=d[Ob]),b},f.getAxisLabelText=function(a){var b=this.getAxisLabelOptionByAxisId(a);return se(b)?b:b?b.text:null},f.setAxisLabelText=function(a,b){var c=this,d=c.config,e=c.getAxisLabelOptionByAxisId(a);se(e)?"y"===a?d[Tb]=b:"y2"===a?d[ac]=b:"x"===a&&(d[Ob]=b):e&&(e.text=b)},f.getAxisLabelPosition=function(a,b){var c=this.getAxisLabelOptionByAxisId(a),d=c&&"object"==typeof c&&c.position?c.position:b;return{isInner:d.indexOf("inner")>=0,isOuter:d.indexOf("outer")>=0,isLeft:d.indexOf("left")>=0,isCenter:d.indexOf("center")>=0,isRight:d.indexOf("right")>=0,isTop:d.indexOf("top")>=0,isMiddle:d.indexOf("middle")>=0,isBottom:d.indexOf("bottom")>=0}},f.getXAxisLabelPosition=function(){return this.getAxisLabelPosition("x",this.config[vb]?"inner-top":"inner-right")},f.getYAxisLabelPosition=function(){return this.getAxisLabelPosition("y",this.config[vb]?"inner-right":"inner-top")},f.getY2AxisLabelPosition=function(){return this.getAxisLabelPosition("y2",this.config[vb]?"inner-right":"inner-top")},f.getAxisLabelPositionById=function(a){return"y2"===a?this.getY2AxisLabelPosition():"y"===a?this.getYAxisLabelPosition():this.getXAxisLabelPosition()},f.textForXAxisLabel=function(){return this.getAxisLabelText("x")},f.textForYAxisLabel=function(){return this.getAxisLabelText("y")},f.textForY2AxisLabel=function(){return this.getAxisLabelText("y2")},f.xForAxisLabel=function(a,b){var c=this;return a?b.isLeft?0:b.isCenter?c.width/2:c.width:b.isBottom?-c.height:b.isMiddle?-c.height/2:0},f.dxForAxisLabel=function(a,b){return a?b.isLeft?"0.5em":b.isRight?"-0.5em":"0":b.isTop?"-0.5em":b.isBottom?"0.5em":"0"},f.textAnchorForAxisLabel=function(a,b){return a?b.isLeft?"start":b.isCenter?"middle":"end":b.isBottom?"start":b.isMiddle?"middle":"end"},f.xForXAxisLabel=function(){return this.xForAxisLabel(!this.config[vb],this.getXAxisLabelPosition())},f.xForYAxisLabel=function(){return this.xForAxisLabel(this.config[vb],this.getYAxisLabelPosition())},f.xForY2AxisLabel=function(){return this.xForAxisLabel(this.config[vb],this.getY2AxisLabelPosition())},f.dxForXAxisLabel=function(){return this.dxForAxisLabel(!this.config[vb],this.getXAxisLabelPosition())},f.dxForYAxisLabel=function(){return this.dxForAxisLabel(this.config[vb],this.getYAxisLabelPosition())},f.dxForY2AxisLabel=function(){return this.dxForAxisLabel(this.config[vb],this.getY2AxisLabelPosition())},f.dyForXAxisLabel=function(){var a=this,b=a.config,c=a.getXAxisLabelPosition();return b[vb]?c.isInner?"1.2em":-25-a.getMaxTickWidth("x"):c.isInner?"-0.5em":b[Mb]?b[Mb]-10:"3em"},f.dyForYAxisLabel=function(){var a=this,b=a.getYAxisLabelPosition();return a.config[vb]?b.isInner?"-0.5em":"3em":b.isInner?"1.2em":-20-a.getMaxTickWidth("y")},f.dyForY2AxisLabel=function(){var a=this,b=a.getY2AxisLabelPosition();return a.config[vb]?b.isInner?"1.2em":"-2.2em":b.isInner?"-0.5em":30+this.getMaxTickWidth("y2")},f.textAnchorForXAxisLabel=function(){var a=this;return a.textAnchorForAxisLabel(!a.config[vb],a.getXAxisLabelPosition())},f.textAnchorForYAxisLabel=function(){var a=this;return a.textAnchorForAxisLabel(a.config[vb],a.getYAxisLabelPosition())},f.textAnchorForY2AxisLabel=function(){var a=this;return a.textAnchorForAxisLabel(a.config[vb],a.getY2AxisLabelPosition())},f.xForRotatedTickText=function(a){return 10*Math.sin(Math.PI*(a/180))},f.yForRotatedTickText=function(a){return 11.5-2.5*(a/15)},f.rotateTickText=function(a,b,c){a.selectAll(".tick text").style("text-anchor","start"),b.selectAll(".tick text").attr("y",this.yForRotatedTickText(c)).attr("x",this.xForRotatedTickText(c)).attr("transform","rotate("+c+")")},f.getMaxTickWidth=function(a){var b,c,d,e=this,f=e.config,g=0;return e.svg&&(b=e.filterTargetsToShow(e.data.targets),"y"===a?(c=e.y.copy().domain(e.getYDomain(b,"y")),d=e.getYAxis(c,e.yOrient,f[Ub],f[Xb])):"y2"===a?(c=e.y2.copy().domain(e.getYDomain(b,"y2")),d=e.getYAxis(c,e.y2Orient,f[bc],f[ec])):(c=e.x.copy().domain(e.getXDomain(b)),d=e.getXAxis(c,e.xOrient,e.getXAxisTickFormat(),f[Gb]?f[Gb]:e.xAxis.tickValues())),e.main.append("g").call(d).each(function(){e.d3.select(this).selectAll("text").each(function(){var a=this.getBoundingClientRect();g=g?e.currentMaxTickWidth:g,e.currentMaxTickWidth},f.updateAxisLabels=function(a){var b=this,c=b.main.select("."+pe[_d]+" ."+pe[ae]),d=b.main.select("."+pe[be]+" ."+pe[ce]),e=b.main.select("."+pe[de]+" ."+pe[ee]);(a?c.transition():c).attr("x",De(b.xForXAxisLabel,b)).attr("dx",De(b.dxForXAxisLabel,b)).attr("dy",De(b.dyForXAxisLabel,b)).text(De(b.textForXAxisLabel,b)),(a?d.transition():d).attr("x",De(b.xForYAxisLabel,b)).attr("dx",De(b.dxForYAxisLabel,b)).attr("dy",De(b.dyForYAxisLabel,b)).text(De(b.textForYAxisLabel,b)),(a?e.transition():e).attr("x",De(b.xForY2AxisLabel,b)).attr("dx",De(b.dxForY2AxisLabel,b)).attr("dy",De(b.dyForY2AxisLabel,b)).text(De(b.textForY2AxisLabel,b))},f.getAxisPadding=function(a,b,c,d){var e="ratio"===a.unit?d:1;return qe(a[b])?a[b]*e:c},f.generateTickValues=function(a,b){var c,d,e,f,g,h,i,j=this,k=a;if(b)if(c=re(b)?b():b,1===c)k=[a[0]];else if(2===c)k=[a[0],a[a.length-1]];else if(c>2){for(f=c-2,d=a[0],e=a[a.length-1],g=(e-d)/(f+1),k=[d],h=0;f>h;h++)i=+d+g*(h+1),k.push(j.isTimeSeries()?new Date(i):i);k.push(e)}return j.isTimeSeries()||(k=k.sort(function(a,b){return a-b})),k},f.generateAxisTransitions=function(a){var b=this,c=b.axes;return{axisX:a?c.x.transition().duration(a):c.x,axisY:a?c.y.transition().duration(a):c.y,axisY2:a?c.y2.transition().duration(a):c.y2,axisSubX:a?c.subx.transition().duration(a):c.subx}},f.redrawAxis=function(a,b){var c=this;c.axes.x.style("opacity",b?0:1),c.axes.y.style("opacity",b?0:1),c.axes.y2.style("opacity",b?0:1),c.axes.subx.style("opacity",b?0:1),a.axisX.call(c.xAxis),a.axisY.call(c.yAxis),a.axisY2.call(c.y2Axis),a.axisSubX.call(c.subXAxis)},f.getClipPath=function(b){var c=a.navigator.appVersion.toLowerCase().indexOf("msie 9.")>=0;return"url("+(c?"":document.URL.split("#")[0])+"#"+b+")"},f.getAxisClipX=function(a){return a?-31:-(this.margin.left-1)},f.getAxisClipY=function(a){return a?-20:-4},f.getXAxisClipX=function(){var a=this;return a.getAxisClipX(!a.config[vb])},f.getXAxisClipY=function(){var a=this;return a.getAxisClipY(!a.config[vb])},f.getYAxisClipX=function(){var a=this;return a.getAxisClipX(a.config[vb])},f.getYAxisClipY=function(){var a=this;return a.getAxisClipY(a.config[vb])},f.getAxisClipWidth=function(a){var b=this;return a?b.width+2+30+30:b.margin.left+20},f.getAxisClipHeight=function(a){var b=this,c=b.config;return a?(c[Mb]?c[Mb]:0)+80:b.height+8},f.getXAxisClipWidth=function(){var a=this;return a.getAxisClipWidth(!a.config[vb])},f.getXAxisClipHeight=function(){var a=this;return a.getAxisClipHeight(!a.config[vb])},f.getYAxisClipWidth=function(){var a=this;return a.getAxisClipWidth(a.config[vb])},f.getYAxisClipHeight=function(){var a=this;return a.getAxisClipHeight(a.config[vb])},f.initPie=function(){var a=this,b=a.d3,c=a.config;a.pie=b.layout.pie().value(function(a){return a.values.reduce(function(a,b){return a+b.value},0)}),c[K]&&c[Ac]&&c[Nc]||a.pie.sort(null)},f.updateRadius=function(){var a=this,b=a.config,c=b[Ic]||b[Mc];a.radiusExpanded=Math.min(a.arcWidth,a.arcHeight)/2,a.radius=.95*a.radiusExpanded,a.innerRadiusRatio=c?(a.radius-c)/a.radius:.6,a.innerRadius=a.hasType("donut")||a.hasType("gauge")?a.radius*a.innerRadiusRatio:0},f.updateArc=function(){var a=this;a.svgArc=a.getSvgArc(),a.svgArcExpanded=a.getSvgArcExpanded(),a.svgArcExpandedSub=a.getSvgArcExpanded(.98)},f.updateAngle=function(a){var b=this,c=b.config,d=!1,e=0;if(b.pie(b.filterTargetsToShow(b.data.targets)).sort(b.descByStartAngle).forEach(function(b){d||b.data.id!==a.data.id||(d=!0,a=b,a.index=e),e++}),isNaN(a.endAngle)&&(a.endAngle=a.startAngle),b.isGaugeType(a.data)){var f=c[Fc],g=c[Gc],h=Math.abs(f)+g,i=Math.PI/h;a.startAngle=-1*(Math.PI/2)+i*Math.abs(f),a.endAngle=a.startAngle+i*(a.value>g?g:a.value)}return d?a:null},f.getSvgArc=function(){var a=this,b=a.d3.svg.arc().outerRadius(a.radius).innerRadius(a.innerRadius),c=function(c,d){var e;return d?b(c):(e=a.updateAngle(c),e?b(e):"M 0 0")};return c.centroid=b.centroid,c},f.getSvgArcExpanded=function(a){var b=this,c=b.d3.svg.arc().outerRadius(b.radiusExpanded*(a?a:1)).innerRadius(b.innerRadius);return function(a){var d=b.updateAngle(a);return d?c(d):"M 0 0"}},f.getArc=function(a,b,c){return c||this.isArcType(a.data)?this.svgArc(a,b):"M 0 0"},f.transformForArcLabel=function(a){var b,c,d,e,f,g=this,h=g.updateAngle(a),i="";return h&&!g.hasType("gauge")&&(b=this.svgArc.centroid(h),c=isNaN(b[0])?0:b[0],d=isNaN(b[1])?0:b[1],e=Math.sqrt(c*c+d*d),f=g.radius&&e?(36/g.radius>.375?1.175-36/g.radius:.8)*g.radius/e:0,i="translate("+c*f+","+d*f+")"),i},f.getArcRatio=function(a){var b=this,c=b.hasType("gauge")?Math.PI:2*Math.PI;return a?(a.endAngle-a.startAngle)/c:null},f.convertToArcData=function(a){return this.addName({id:a.data.id,value:a.value,ratio:this.getArcRatio(a),index:a.index})},f.textForArcLabel=function(a){var b,c,d,e,f=this;return f.shouldShowArcLabel()?(b=f.updateAngle(a),c=b?b.value:null,d=f.getArcRatio(b),f.hasType("gauge")||f.meetsArcLabelThreshold(d)?(e=f.getArcLabelFormat(),e?e(c,d):f.defaultArcValueFormat(c,d)):""):""},f.expandArc=function(a,b){var c=this,d=c.svg.selectAll("."+pe[gd]+c.selectorTarget(a)),e=c.svg.selectAll("."+pe[Id]).filter(function(b){return b.data.id!==a});c.shouldExpand(a)&&d.selectAll("path").transition().duration(50).attr("d",c.svgArcExpanded).transition().duration(100).attr("d",c.svgArcExpandedSub).each(function(a){c.isDonutType(a.data)}),b||e.style("opacity",.3)},f.unexpandArc=function(a){var b=this,c=b.svg.selectAll("."+pe[gd]+b.selectorTarget(a));c.selectAll("path."+pe[Id]).transition().duration(50).attr("d",b.svgArc),b.svg.selectAll("."+pe[Id]).style("opacity",1)},f.shouldExpand=function(a){var b=this,c=b.config;return b.isDonutType(a)&&c[Oc]||b.isGaugeType(a)&&c[Ec]||b.isPieType(a)&&c[Bc]},f.shouldShowArcLabel=function(){var a=this,b=a.config,c=!0;return a.hasType("donut")?c=b[Jc]:a.hasType("pie")&&(c=b[xc]),c},f.meetsArcLabelThreshold=function(a){var b=this,c=b.config,d=b.hasType("donut")?c[Lc]:c[zc];return a>=d},f.getArcLabelFormat=function(){var a=this,b=a.config,c=b[yc];return a.hasType("gauge")?c=b[Dc]:a.hasType("donut")&&(c=b[Kc]),c},f.getArcTitle=function(){var a=this;return a.hasType("donut")?a.config[Pc]:""},f.descByStartAngle=function(a,b){return a.startAngle-b.startAngle},f.updateTargetsForArc=function(a){var b,c,d=this,e=d.main;b=e.select("."+pe[hd]).selectAll("."+pe[gd]).data(d.pie(a)).attr("class",De(d.classChartArc,d)),c=b.enter().append("g").attr("class",De(d.classChartArc,d)),c.append("g").attr("class",De(d.classArcs,d)),c.append("text").attr("dy",d.hasType("gauge")?"-0.35em":".35em").style("opacity",0).style("text-anchor","middle").style("pointer-events","none")},f.initArc=function(){var a=this;a.arcs=a.main.select("."+pe[_c]).append("g").attr("class",pe[hd]).attr("transform",a.getTranslate("arc")),a.arcs.append("text").attr("class",pe[id]).style("text-anchor","middle").text(a.getArcTitle())},f.redrawArc=function(a,b,c){var d,e=this,f=e.d3,g=e.config,h=e.main;d=h.selectAll("."+pe[Jd]).selectAll("."+pe[Id]).data(De(e.arcData,e)),d.enter().append("path").attr("class",De(e.classArc,e)).style("fill",function(a){return e.color(a.data)}).style("cursor",function(a){return g[S](a)?"pointer":null}).style("opacity",0).each(function(a){e.isGaugeType(a.data)&&(a.startAngle=a.endAngle=-1*(Math.PI/2)),this._current=a}).on("mouseover",function(a){var b,c;e.transiting||(b=e.updateAngle(a),c=e.convertToArcData(b),e.expandArc(b.data.id),e.toggleFocusLegend(b.data.id,!0),e.config[V](c,this))}).on("mousemove",function(a){var b=e.updateAngle(a),c=e.convertToArcData(b),d=[c];e.showTooltip(d,f.mouse(this))}).on("mouseout",function(a){var b,c;e.transiting||(b=e.updateAngle(a),c=e.convertToArcData(b),e.unexpandArc(b.data.id),e.revertLegend(),e.hideTooltip(),e.config[W](c,this))}).on("click",function(a,b){var c,d;e.toggleShape&&(c=e.updateAngle(a),d=e.convertToArcData(c),e.toggleShape(this,d,b))}),d.attr("transform",function(a){return!e.isGaugeType(a.data)&&c?"scale(0)":""}).style("opacity",function(a){return a===this._current?0:1}).each(function(){e.transiting=!0}).transition().duration(a).attrTween("d",function(a){var b,c=e.updateAngle(a);return c?(isNaN(this._current.endAngle)&&(this._current.endAngle=this._current.startAngle),b=f.interpolate(this._current,c),this._current=b(0),function(a){return e.getArc(b(a),!0)}):function(){return"M 0 0"}}).attr("transform",c?"scale(1)":"").style("fill",function(a){return e.levelColor?e.levelColor(a.data.values[0].value):e.color(a.data.id)}).style("opacity",1).call(e.endall,function(){e.transiting=!1}),d.exit().transition().duration(b).style("opacity",0).remove(),h.selectAll("."+pe[gd]).select("text").style("opacity",0).attr("class",function(a){return e.isGaugeType(a.data)?pe[Pd]:""}).text(De(e.textForArcLabel,e)).attr("transform",De(e.transformForArcLabel,e)).transition().duration(a).style("opacity",function(a){return e.isTargetToShow(a.data.id)&&e.isArcType(a.data)?1:0}),h.select("."+pe[id]).style("opacity",e.hasType("donut")||e.hasType("gauge")?1:0)},f.initGauge=function(){var a=this,b=a.config,c=a.arcs;a.hasType("gauge")&&(c.append("path").attr("class",pe[jd]).attr("d",function(){var c={data:[{value:b[Gc]}],startAngle:-1*(Math.PI/2),endAngle:Math.PI/2};return a.getArc(c,!0,!0)}),c.append("text").attr("dy",".75em").attr("class",pe[kd]).style("text-anchor","middle").style("pointer-events","none").text(b[Cc]?b[Hc]:""),c.append("text").attr("dx",-1*(a.innerRadius+(a.radius-a.innerRadius)/2)+"px").attr("dy","1.2em").attr("class",pe[md]).style("text-anchor","middle").style("pointer-events","none").text(b[Cc]?b[Fc]:""),c.append("text").attr("dx",a.innerRadius+(a.radius-a.innerRadius)/2+"px").attr("dy","1.2em").attr("class",pe[ld]).style("text-anchor","middle").style("pointer-events","none").text(b[Cc]?b[Gc]:""))},f.initRegion=function(){var a=this,b=a.CLASS;a.main.append("g").attr("clip-path",a.clipPath).attr("class",b[xd])},f.redrawRegion=function(a){var b=this,c=b.config,d=b.CLASS;b.mainRegion=b.main.select("."+d[xd]).selectAll("."+d[wd]).data(c[Qc]),b.mainRegion.enter().append("g").attr("class",De(b.classRegion,b)).append("rect").style("fill-opacity",0),b.mainRegion.exit().transition().duration(a).style("opacity",0).remove()},f.addTransitionForRegion=function(a){var b=this;a.push(b.mainRegion.selectAll("rect").transition().attr("x",De(b.regionX,b)).attr("y",De(b.regionY,b)).attr("width",De(b.regionWidth,b)).attr("height",De(b.regionHeight,b)).style("fill-opacity",function(a){return qe(a.opacity)?a.opacity:.1}))},f.regionX=function(a){var b,c=this,d=c.config,e="y"===a.axis?c.y:c.y2;return b="y"===a.axis||"y2"===a.axis?d[vb]?"start"in a?e(a.start):0:0:d[vb]?0:"start"in a?c.x(c.isTimeSeries()?c.parseDate(a.start):a.start):0},f.regionY=function(a){var b,c=this,d=c.config,e="y"===a.axis?c.y:c.y2;return b="y"===a.axis||"y2"===a.axis?d[vb]?0:"end"in a?e(a.end):0:d[vb]?"start"in a?c.x(c.isTimeSeries()?c.parseDate(a.start):a.start):0:0},f.regionWidth=function(a){var b,c=this,d=c.config,e=c.regionX(a),f="y"===a.axis?c.y:c.y2;return b="y"===a.axis||"y2"===a.axis?d[vb]?"end"in a?f(a.end):c.width:c.width:d[vb]?c.width:"end"in a?c.x(c.isTimeSeries()?c.parseDate(a.end):a.end):c.width,e>b?0:b-e},f.regionHeight=function(a){var b,c=this,d=c.config,e=this.regionY(a),f="y"===a.axis?c.y:c.y2;return b="y"===a.axis||"y2"===a.axis?d[vb]?c.height:"start"in a?f(a.start):c.height:d[vb]?"end"in a?c.x(c.isTimeSeries()?c.parseDate(a.end):a.end):c.height:c.height,e>b?0:b-e},f.isRegionOnX=function(a){return!a.axis||"x"===a.axis},f.drag=function(a){var b,c,d,e,f,g,h,i,j=this,k=j.config,l=j.main,m=j.d3;j.hasArcType()||k[Q]&&(!k[o]||j.zoom.altDomain)&&k[T]&&(b=j.dragStart[0],c=j.dragStart[1],d=a[0],e=a[1],f=Math.min(b,d),g=Math.max(b,d),h=k[R]?j.margin.top:Math.min(c,e),i=k[R]?j.height:Math.max(c,e),l.select("."+pe[le]).attr("x",f).attr("y",h).attr("width",g-f).attr("height",i-h),l.selectAll("."+pe[Bd]).selectAll("."+pe[Ad]).filter(function(a){return k[S](a)}).each(function(a,b){var c,d,e,k,l,n,o=m.select(this),p=o.classed(pe[ne]),q=o.classed(pe[oe]),r=!1;if(o.classed(pe[Gd]))c=1*o.attr("cx"),d=1*o.attr("cy"),l=j.togglePoint,r=c>f&&g>c&&d>h&&i>d;else{if(!o.classed(pe[Ed]))return;n=Ce(this),c=n.x,d=n.y,e=n.width,k=n.height,l=j.toggleBar,r=!(c>g||f>c+e||d>i||h>d+k)}r^q&&(o.classed(pe[oe],!q),o.classed(pe[ne],!p),l.call(j,!p,o,a,b))}))},f.dragstart=function(a){var b=this,c=b.config;b.hasArcType()||c[Q]&&(b.dragStart=a,b.main.select("."+pe[_c]).append("rect").attr("class",pe[le]).style("opacity",.1),b.dragging=!0,b.config[Z]())},f.dragend=function(){var a=this,b=a.config;a.hasArcType()||b[Q]&&(a.main.select("."+pe[le]).transition().duration(100).style("opacity",0).remove(),a.main.selectAll("."+pe[Ad]).classed(pe[oe],!1),a.dragging=!1,a.config[$]())},f.selectPoint=function(a,b,c){var d=this,e=d.config,f=De(e[vb]?d.circleY:d.circleX,d),g=De(e[vb]?d.circleX:d.circleY,d);e[X].call(d.api,b,a.node()),d.main.select("."+pe[od]+d.getTargetSelectorSuffix(b.id)).selectAll("."+pe[nd]+"-"+c).data([b]).enter().append("circle").attr("class",function(){return d.generateClass(pe[nd],c)}).attr("cx",f).attr("cy",g).attr("stroke",function(){return d.color(b)}).attr("r",function(a){return 1.4*d.pointSelectR(a)}).transition().duration(100).attr("r",De(d.pointSelectR,d))},f.unselectPoint=function(a,b,c){var d=this;d.config[Y](b,a.node()),d.main.select("."+pe[od]+d.getTargetSelectorSuffix(b.id)).selectAll("."+pe[nd]+"-"+c).transition().duration(100).attr("r",0).remove()},f.togglePoint=function(a,b,c,d){a?this.selectPoint(b,c,d):this.unselectPoint(b,c,d)},f.selectBar=function(a,b){var c=this;c.config[X].call(c,b,a.node()),a.transition().duration(100).style("fill",function(){return c.d3.rgb(c.color(b)).brighter(.75)})},f.unselectBar=function(a,b){var c=this;c.config[Y].call(c,b,a.node()),a.transition().duration(100).style("fill",function(){return c.color(b)})},f.toggleBar=function(a,b,c,d){a?this.selectBar(b,c,d):this.unselectBar(b,c,d)},f.toggleArc=function(a,b,c,d){this.toggleBar(a,b,c.data,d)},f.getToggle=function(a){var b=this;return"circle"===a.nodeName?b.togglePoint:b.d3.select(a).classed(pe[Ed])?b.toggleBar:b.toggleArc},f.toggleShape=function(a,b,c){var d,e,f=this,g=f.d3,h=f.config,i=g.select(a),j=i.classed(pe[ne]);"circle"===a.nodeName?(d=f.isWithinCircle(a,1.5*f.pointSelectR(b)),e=f.togglePoint):"path"===a.nodeName&&(i.classed(pe[Ed])?(d=f.isWithinBar(a),e=f.toggleBar):(d=!0,e=f.toggleArc)),(h[R]||d)&&(h[Q]&&h[S](b)&&(h[T]||f.main.selectAll("."+pe[Bd]+(h[R]?f.getTargetSelectorSuffix(b.id):"")).selectAll("."+pe[Ad]).each(function(a,b){var c=g.select(this);c.classed(pe[ne])&&e.call(f,!1,c.classed(pe[ne],!1),a,b)}),i.classed(pe[ne],!j),e.call(f,!j,i,b,c)),f.config[U].call(f.api,b,a))},f.initBrush=function(){var a=this,b=a.d3;a.brush=b.svg.brush().on("brush",function(){a.redrawForBrush()}),a.brush.update=function(){return a.context&&a.context.select("."+a.CLASS[ud]).call(this),this},a.brush.scale=function(b){return a.config[vb]?this.y(b):this.x(b)}},f.initSubchart=function(){var a=this,b=a.config,c=a.context=a.svg.append("g").attr("transform",a.getTranslate("context"));b[gb]||c.style("visibility","hidden"),c.append("g").attr("clip-path",a.clipPath).attr("class",pe[_c]),c.select("."+pe[_c]).append("g").attr("class",pe[dd]),c.select("."+pe[_c]).append("g").attr("class",pe[bd]),c.append("g").attr("clip-path",a.clipPath).attr("class",pe[ud]).call(a.brush).selectAll("rect").attr(b[vb]?"width":"height",b[vb]?a.width2:a.height2),a.axes.subx=c.append("g").attr("class",pe[_d]).attr("transform",a.getTranslate("subx")).attr("clip-path",b[vb]?"":a.clipPathForXAxis)},f.updateTargetsForSubchart=function(a){var b,c,d,e,f=this,g=f.context,h=f.config;h[gb]&&(e=g.select("."+pe[dd]).selectAll("."+pe[cd]).data(a).attr("class",De(f.classChartBar,f)),d=e.enter().append("g").style("opacity",0).attr("class",De(f.classChartBar,f)),d.append("g").attr("class",De(f.classBars,f)),c=g.select("."+pe[bd]).selectAll("."+pe[ad]).data(a).attr("class",De(f.classChartLine,f)),b=c.enter().append("g").style("opacity",0).attr("class",De(f.classChartLine,f)),b.append("g").attr("class",De(f.classLines,f)),b.append("g").attr("class",De(f.classAreas,f)))},f.redrawSubchart=function(a,b,c,d,e,f,g){var h,i,j,k,l,m,n=this,o=n.d3,p=n.context,q=n.config;q[gb]&&(o.event&&"zoom"===o.event.type&&n.brush.extent(n.x.orgDomain()).update(),a&&(!q[vb]&&q[Hb]&&n.rotateTickText(n.axes.subx,b.axisSubX,q[Hb]),n.brush.empty()||n.brush.extent(n.x.orgDomain()).update(),k=n.generateDrawArea(e,!0),l=n.generateDrawBar(f,!0),m=n.generateDrawLine(g,!0),j=p.selectAll("."+pe[Fd]).selectAll("."+pe[Ed]).data(De(n.barData,n)),j.enter().append("path").attr("class",De(n.classBar,n)).style("stroke","none").style("fill",n.color),j.style("opacity",De(n.initialOpacity,n)).transition().duration(c).attr("d",l).style("opacity",1),j.exit().transition().duration(c).style("opacity",0).remove(),h=p.selectAll("."+pe[Dd]).selectAll("."+pe[Cd]).data(De(n.lineData,n)),h.enter().append("path").attr("class",De(n.classLine,n)).style("stroke",n.color),h.style("opacity",De(n.initialOpacity,n)).transition().duration(c).attr("d",m).style("opacity",1),h.exit().transition().duration(c).style("opacity",0).remove(),i=p.selectAll("."+pe[Ld]).selectAll("."+pe[Kd]).data(De(n.lineData,n)),i.enter().append("path").attr("class",De(n.classArea,n)).style("fill",n.color).style("opacity",function(){return n.orgAreaOpacity=+o.select(this).style("opacity"),0}),i.style("opacity",0).transition().duration(c).attr("d",k).style("fill",n.color).style("opacity",n.orgAreaOpacity),i.exit().transition().duration(d).style("opacity",0).remove()))},f.redrawForBrush=function(){var a=this,b=a.x;a.redraw({withTransition:!1,withY:!1,withSubchart:!1,withUpdateXDomain:!0}),a.config[ib].call(a.api,b.orgDomain())},f.transformContext=function(a,b){var c,d=this;b&&b.axisSubX?c=b.axisSubX:(c=d.context.select("."+pe[_d]),a&&(c=c.transition())),d.context.attr("transform",d.getTranslate("context")),c.attr("transform",d.getTranslate("subx"))},f.initZoom=function(){var a=this,b=a.d3,c=a.config;a.zoom=b.behavior.zoom().on("zoomstart",function(){a.zoom.altDomain=b.event.sourceEvent.altKey?a.x.orgDomain():null}).on("zoom",function(){a.redrawForZoom.call(a)}),a.zoom.scale=function(a){return c[vb]?this.y(a):this.x(a) },a.zoom.orgScaleExtent=function(){var b=c[p]?c[p]:[1,10];return[b[0],Math.max(a.getMaxDataCount()/b[1],b[1])]},a.zoom.updateScaleExtent=function(){var b=xe(a.x.orgDomain())/xe(a.orgXDomain),c=this.orgScaleExtent();return this.scaleExtent([c[0]*b,c[1]*b]),this}},f.updateZoom=function(){var a=this,b=a.config[o]?a.zoom:function(){};a.main.select("."+a.CLASS[td]).call(b),a.main.selectAll("."+a.CLASS[pd]).call(b)},f.redrawForZoom=function(){var a=this,b=a.d3,c=a.config,d=a.zoom,e=a.x,f=a.orgXDomain;if(c[o]&&0!==a.filterTargetsToShow(a.data.targets).length){if("mousemove"===b.event.sourceEvent.type&&d.altDomain)return e.domain(d.altDomain),void d.scale(e).updateScaleExtent();a.isCategorized()&&e.orgDomain()[0]===f[0]&&e.domain([f[0]-1e-10,e.orgDomain()[1]]),a.redraw({withTransition:!1,withY:!1,withSubchart:!1}),"mousemove"===b.event.sourceEvent.type&&(a.cancelClick=!0),c[r].call(a.api,e.orgDomain())}},f.generateColor=function(){var a=this,b=a.config,c=a.d3,d=b[N],e=ze(b[jb])?b[jb]:c.scale.category10().range(),f=b[M],g=[];return function(a){var b,c=a.id||a;return d[c]instanceof Function?b=d[c](a):d[c]?b=d[c]:(g.indexOf(c)<0&&g.push(c),b=e[g.indexOf(c)%e.length],d[c]=b),f instanceof Function?f(b,a):b}},f.generateLevelColor=function(){var a=this,b=a.config,c=b[jb],d=b[kb],e="value"===d.unit,f=d.values&&d.values.length?d.values:[],g=d.max||100;return ze(b[kb])?function(a){var b,d,h=c[c.length-1];for(b=0;b0},Ae=f.getOption=function(a,b,c){return ue(a[b])?a[b]:c},Be=f.hasValue=function(a,b){var c=!1;return Object.keys(a).forEach(function(d){a[d]===b&&(c=!0)}),c},Ce=f.getPathBox=function(a){var b=a.getBoundingClientRect(),c=[a.pathSegList.getItem(0),a.pathSegList.getItem(1)],d=c[0].x,e=Math.min(c[0].y,c[1].y);return{x:d,y:e,width:b.width,height:b.height}},De=f.generateCall=function(a,b){return function(c,d){return a.call(b,c,d)}};e.focus=function(a){function b(a){c.filterTargetsToShow(a).transition().duration(100).style("opacity",1)}var c=this.internal,d=c.svg.selectAll(c.selectorTarget(a)),e=d.filter(De(c.isNoneArc,c)),f=d.filter(De(c.isArc,c));this.revert(),this.defocus(),b(e.classed(pe[vd],!0)),b(f),c.hasArcType()&&c.expandArc(a,!0),c.toggleFocusLegend(a,!0)},e.defocus=function(a){function b(a){c.filterTargetsToShow(a).transition().duration(100).style("opacity",.3)}var c=this.internal,d=c.svg.selectAll(c.selectorTarget(a)),e=d.filter(De(c.isNoneArc,c)),f=d.filter(De(c.isArc,c));this.revert(),b(e.classed(pe[vd],!1)),b(f),c.hasArcType()&&c.unexpandArc(a),c.toggleFocusLegend(a,!1)},e.revert=function(a){function b(a){c.filterTargetsToShow(a).transition().duration(100).style("opacity",1)}var c=this.internal,d=c.svg.selectAll(c.selectorTarget(a)),e=d.filter(De(c.isNoneArc,c)),f=d.filter(De(c.isArc,c));b(e.classed(pe[vd],!1)),b(f),c.hasArcType()&&c.unexpandArc(a),c.revertLegend()},e.show=function(a,b){var c=this.internal;a=c.mapToTargetIds(a),b=b||{},c.removeHiddenTargetIds(a),c.svg.selectAll(c.selectorTargets(a)).transition().style("opacity",1),b.withLegend&&c.showLegend(a),c.redraw({withUpdateOrgXDomain:!0,withUpdateXDomain:!0,withLegend:!0})},e.hide=function(a,b){var c=this.internal;a=c.mapToTargetIds(a),b=b||{},c.addHiddenTargetIds(a),c.svg.selectAll(c.selectorTargets(a)).transition().style("opacity",0),b.withLegend&&c.hideLegend(a),c.redraw({withUpdateOrgXDomain:!0,withUpdateXDomain:!0,withLegend:!0})},e.toggle=function(a){var b=this.internal;b.isTargetToShow(a)?this.hide(a):this.show(a)},e.zoom=function(){},e.zoom.enable=function(a){var b=this.internal;b.config[o]=a,b.updateAndRedraw()},e.unzoom=function(){var a=this.internal;a.brush.clear().update(),a.redraw({withUpdateXDomain:!0})},e.load=function(a){var b=this.internal,c=b.config;return a.xs&&b.addXs(a.xs),"classes"in a&&Object.keys(a.classes).forEach(function(b){c[E][b]=a.classes[b]}),"categories"in a&&b.isCategorized()&&(c[zb]=a.categories),"cacheIds"in a&&b.hasCaches(a.cacheIds)?void b.load(b.getCaches(a.cacheIds),a.done):void("unload"in a?b.unload(b.mapToTargetIds("boolean"==typeof a.unload&&a.unload?null:a.unload),function(){b.loadFromArgs(a)}):b.loadFromArgs(a))},e.unload=function(a){var b=this.internal;a=a||{},b.unload(b.mapToTargetIds(a.ids),function(){b.redraw({withUpdateOrgXDomain:!0,withUpdateXDomain:!0,withLegend:!0}),a.done&&a.done()})},e.flow=function(a){var b,c,d,e,f,g,h,i,j=this.internal,k=[],l=j.getMaxDataCount(),m=0,n=0;if(a.json)c=j.convertJsonToData(a.json,a.keys);else if(a.rows)c=j.convertRowsToData(a.rows);else{if(!a.columns)return;c=j.convertColumnsToData(a.columns)}b=j.convertDataToTargets(c,!0),j.data.targets.forEach(function(a){var c,d,e=!1;for(c=0;cd;d++)b[c].values[d].index=n+d,j.isTimeSeries()||(b[c].values[d].x=n+d);a.values=a.values.concat(b[c].values),b.splice(c,1);break}e||k.push(a.id)}),j.data.targets.forEach(function(a){var b,c;for(b=0;bc;c++)a.values.push({id:a.id,index:n+c,x:j.isTimeSeries()?j.getOtherTargetX(n+c):n+c,value:null})}),j.data.targets.length&&b.forEach(function(a){var b,c=[];for(b=j.data.targets[0].values[0].index;n>b;b++)c.push({id:a.id,index:b,x:j.isTimeSeries()?j.getOtherTargetX(b):b,value:null});a.values.forEach(function(a){a.index+=n,j.isTimeSeries()||(a.x+=n)}),a.values=c.concat(a.values)}),j.data.targets=j.data.targets.concat(b),d=j.getMaxDataCount(),f=j.data.targets[0],g=f.values[0],ue(a.to)?(m=0,i=j.isTimeSeries()?j.parseDate(a.to):a.to,f.values.forEach(function(a){a.x1?f.values[f.values.length-1].x-g.x:g.x-j.getXDomain(j.data.targets)[0]:1,e=[g.x-h,g.x],j.updateXDomain(null,!0,!0,e)),j.updateTargets(j.data.targets),j.redraw({flow:{index:g.index,length:m,duration:qe(a.duration)?a.duration:j.config[x],done:a.done,orgDataCount:l},withLegend:!0,withTransition:l>1})},e.selected=function(a){var b=this.internal,c=b.d3;return c.merge(b.main.selectAll("."+pe[Bd]+b.getTargetSelectorSuffix(a)).selectAll("."+pe[Ad]).filter(function(){return c.select(this).classed(pe[ne])}).map(function(a){return a.map(function(a){var b=a.__data__;return b.data?b.data:b})}))},e.select=function(a,b,c){var d=this.internal,e=d.d3,f=d.config;f[Q]&&d.main.selectAll("."+pe[Bd]).selectAll("."+pe[Ad]).each(function(g,h){var i=e.select(this),j=g.data?g.data.id:g.id,k=d.getToggle(this),l=f[R]||!a||a.indexOf(j)>=0,m=!b||b.indexOf(h)>=0,n=i.classed(pe[ne]);i.classed(pe[Cd])||i.classed(pe[Kd])||(l&&m?f[S](g)&&!n&&k(!0,i.classed(pe[ne],!0),g,h):ue(c)&&c&&n&&k(!1,i.classed(pe[ne],!1),g,h))})},e.unselect=function(a,b){var c=this.internal,d=c.d3,e=c.config;e[Q]&&c.main.selectAll("."+pe[Bd]).selectAll("."+pe[Ad]).each(function(f,g){var h=d.select(this),i=f.data?f.data.id:f.id,j=c.getToggle(this),k=e[R]||!a||a.indexOf(i)>=0,l=!b||b.indexOf(g)>=0,m=h.classed(pe[ne]);h.classed(pe[Cd])||h.classed(pe[Kd])||k&&l&&e[S](f)&&m&&j(!1,h.classed(pe[ne],!1),f,g)})},e.transform=function(a,b){var c=this.internal,d=["pie","donut"].indexOf(a)>=0?{withTransform:!0}:null;c.transformTo(b,a,d)},e.groups=function(a){var b=this.internal,c=b.config;return te(a)?c[F]:(c[F]=a,b.redraw(),c[F])},e.xgrids=function(a){var b=this.internal,c=b.config;return a?(c[hc]=a,b.redraw(),c[hc]):c[hc]},e.xgrids.add=function(a){var b=this.internal;return this.xgrids(b.config[hc].concat(a?a:[]))},e.xgrids.remove=function(a){var b=this.internal;b.removeGridLines(a,!0)},e.ygrids=function(a){var b=this.internal,c=b.config;return a?(c[jc]=a,b.redraw(),c[jc]):c[jc]},e.ygrids.add=function(a){var b=this.internal;return this.ygrids(b.config[jc].concat(a?a:[]))},e.ygrids.remove=function(a){var b=this.internal;b.removeGridLines(a,!1)},e.regions=function(a){var b=this.internal,c=b.config;return a?(c[Qc]=a,b.redraw(),c[Qc]):c[Qc]},e.regions.add=function(a){var b=this.internal,c=b.config;return a?(c[Qc]=c[Qc].concat(a),b.redraw(),c[Qc]):c[Qc]},e.regions.remove=function(a){var b,c,d,e=this.internal,f=e.config;return a=a||{},b=e.getOption(a,"duration",f[x]),c=e.getOption(a,"classes",[pe[wd]]),d=e.main.select("."+pe[xd]).selectAll(c.map(function(a){return"."+a})),(b?d.transition().duration(b):d).style("opacity",0).remove(),f[Qc]=f[Qc].filter(function(a){var b=!1;return a.class?(a.class.split(" ").forEach(function(a){c.indexOf(a)>=0&&(b=!0)}),!b):!0}),f[Qc]},e.data=function(){},e.data.get=function(a){var b=this.data.getAsTarget(a);return ue(b)?b.values.map(function(a){return a.value}):void 0},e.data.getAsTarget=function(a){var b=this.data.targets.filter(function(b){return b.id===a});return b.length>0?b[0]:void 0},e.data.names=function(a){var b=this.internal,c=b.config;return arguments.length?(Object.keys(a).forEach(function(b){c[D][b]=a[b]}),b.redraw({withLegend:!0}),c[D]):c[D]},e.data.colors=function(a){var b=this.internal,c=b.config;return arguments.length?(Object.keys(a).forEach(function(b){c[N][b]=a[b]}),b.redraw({withLegend:!0}),c[N]):c[N]},e.category=function(a,b){var c=this.internal,d=c.config;return arguments.length>1&&(d[zb][a]=b,c.redraw()),d[zb][a]},e.categories=function(a){var b=this.internal,c=b.config;return arguments.length?(c[zb]=a,b.redraw(),c[zb]):c[zb]},e.color=function(a){var b=this.internal;return b.color(a)},e.x=function(a){var b=this.internal;return arguments.length&&(b.updateTargetX(b.data.targets,a),b.redraw({withUpdateOrgXDomain:!0,withUpdateXDomain:!0})),b.data.xs},e.xs=function(a){var b=this.internal;return arguments.length&&(b.updateTargetXs(b.data.targets,a),b.redraw({withUpdateOrgXDomain:!0,withUpdateXDomain:!0})),b.data.xs},e.axis=function(){},e.axis.labels=function(a){var b=this.internal;arguments.length&&(Object.keys(a).forEach(function(c){b.setAxisLabelText(c,a[c])}),b.updateAxisLabels())},e.axis.max=function(a){var b=this.internal,c=b.config;arguments.length&&("object"==typeof a?(qe(a.x)&&(c[Jb]=a.x),qe(a.y)&&(c[Qb]=a.y),qe(a.y2)&&(c[Zb]=a.y2)):c[Qb]=c[Zb]=a,b.redraw({withUpdateOrgXDomain:!0,withUpdateXDomain:!0}))},e.axis.min=function(a){var b=this.internal,c=b.config;arguments.length&&("object"==typeof a?(qe(a.x)&&(c[Kb]=a.x),qe(a.y)&&(c[Rb]=a.y),qe(a.y2)&&(c[$b]=a.y2)):c[Rb]=c[$b]=a,b.redraw({withUpdateOrgXDomain:!0,withUpdateXDomain:!0}))},e.axis.range=function(a){arguments.length&&(ue(a.max)&&this.axis.max(a.max),ue(a.min)&&this.axis.min(a.min))},e.legend=function(){},e.legend.show=function(a){var b=this.internal;b.showLegend(b.mapToTargetIds(a)),b.updateAndRedraw({withLegend:!0})},e.legend.hide=function(a){var b=this.internal;b.hideLegend(b.mapToTargetIds(a)),b.updateAndRedraw({withLegend:!0})},e.resize=function(a){var b=this.internal,c=b.config;c[i]=a?a.width:null,c[j]=a?a.height:null,this.flush()},e.flush=function(){var a=this.internal;a.updateAndRedraw({withLegend:!0,withTransition:!1,withTransitionForTransform:!1})},e.destroy=function(){var b=this.internal;b.data.targets=void 0,b.data.xs={},b.selectChart.classed("c3",!1).html(""),a.onresize=null},"function"==typeof define&&define.amd?define("c3",["d3"],g):"undefined"!=typeof exports&&"undefined"!=typeof module?module.exports=g:a.c3=g}(window);