mirror of https://github.com/masayuki0812/c3.git
Quite good looking graph derived from d3.js
http://c3js.org
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
4 lines
113 KiB
4 lines
113 KiB
!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]);b<c[1];b++)d.push(b);return d.length>0&&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]<b&&b<B[1]?o:0}var j,k,t=a.select(this),u=this.__chart__||m,v=this.__chart__=g(),w=r?r:f(v),x=t.selectAll(".tick").data(w,v),y=x.enter().insert("g",".domain").attr("class","tick").style("opacity",1e-6),z=x.exit().remove(),A=a.transition(x).style("opacity",1),B=m.rangeExtent?m.rangeExtent():e(m.range()),C=t.selectAll(".domain").data([0]),D=(C.enter().append("path").attr("class","domain"),a.transition(C));y.append("line"),y.append("text");var E=y.select("line"),F=A.select("line"),G=x.select("text").text(h),H=y.select("text"),I=A.select("text");switch(b?(s=Math.ceil((v(1)-v(0))/2),k=l?0:s):s=k=0,n){case"bottom":j=c,E.attr("y2",o),H.attr("y",Math.max(o,0)+q),F.attr("x1",k).attr("x2",k).attr("y2",i),I.attr("x",0).attr("y",Math.max(o,0)+q),G.attr("dy",".71em").style("text-anchor","middle"),D.attr("d","M"+B[0]+","+p+"V0H"+B[1]+"V"+p);break;case"top":j=c,E.attr("y2",-o),H.attr("y",-(Math.max(o,0)+q)),F.attr("x2",0).attr("y2",-o),I.attr("x",0).attr("y",-(Math.max(o,0)+q)),G.attr("dy","0em").style("text-anchor","middle"),D.attr("d","M"+B[0]+","+-p+"V0H"+B[1]+"V"+-p);break;case"left":j=d,E.attr("x2",-o),H.attr("x",-(Math.max(o,0)+q)),F.attr("x2",-o).attr("y2",0),I.attr("x",-(Math.max(o,0)+q)).attr("y",s),G.attr("dy",".32em").style("text-anchor","end"),D.attr("d","M"+-p+","+B[0]+"H0V"+B[1]+"H"+-p);break;case"right":j=d,E.attr("x2",o),H.attr("x",Math.max(o,0)+q),F.attr("x2",o).attr("y2",0),I.attr("x",Math.max(o,0)+q).attr("y",0),G.attr("dy",".32em").style("text-anchor","start"),D.attr("d","M"+p+","+B[0]+"H0V"+B[1]+"H"+p)}if(v.rangeBand){var J=v,K=J.rangeBand()/2;u=v=function(a){return J(a)+K}}else u.rangeBand?u=v:z.call(j,v);y.call(j,u),A.call(j,v)})}var j,k,l,m=a.scale.linear(),n="bottom",o=6,p=6,q=3,r=null,s=0,t=!0;return i.scale=function(a){return arguments.length?(m=a,i):m},i.orient=function(a){return arguments.length?(n=a in{top:1,right:1,bottom:1,left:1}?a+"":"bottom",i):n},i.tickFormat=function(a){return arguments.length?(j=a,i):j},i.tickCentered=function(a){return arguments.length?(l=a,i):l},i.tickOffset=function(){return s},i.ticks=function(){return arguments.length?(k=arguments,i):k},i.tickCulling=function(a){return arguments.length?(t=a,i):t},i.tickValues=function(a){if("function"==typeof a)r=function(){return a(m.domain())};else{if(!arguments.length)return r;r=a}return i},i}var e,f,g={version:"0.3.0"};g.generate=function(a){return new b(a)},g.chart={fn:b.prototype,internal:{fn:c.prototype}},e=g.chart.fn,f=g.chart.internal.fn,f.init=function(){var a=this,b=a.config;if(a.initParams(),b[_])a.convertUrlToData(b[_],b[db],b[eb],a.initWithData);else if(b[ab])a.initWithData(a.convertJsonToData(b[ab],b[eb]));else if(b[bb])a.initWithData(a.convertRowsToData(b[bb]));else{if(!b[cb])throw Error("url or json or rows or columns is required.");a.initWithData(a.convertColumnsToData(b[cb]))}},f.initParams=function(){var a=this,b=a.d3,c=a.config;a.clipId="c3-"+ +new Date+"-clip",a.clipIdForXAxis=a.clipId+"-xaxis",a.clipIdForYAxis=a.clipId+"-yaxis",a.clipPath=a.getClipPath(a.clipId),a.clipPathForXAxis=a.getClipPath(a.clipIdForXAxis),a.clipPathForYAxis=a.getClipPath(a.clipIdForYAxis),a.dragStart=null,a.dragging=!1,a.cancelClick=!1,a.mouseover=!1,a.transiting=!1,a.color=a.generateColor(),a.levelColor=a.generateLevelColor(),a.dataTimeFormat=c[B]?b.time.format:b.time.format.utc,a.axisTimeFormat=c[yb]?b.time.format:b.time.format.utc,a.defaultAxisTimeFormat=a.axisTimeFormat.multi([[".%L",function(a){return a.getMilliseconds()}],[":%S",function(a){return a.getSeconds()}],["%I:%M",function(a){return a.getMinutes()}],["%I %p",function(a){return a.getHours()}],["%-m/%-d",function(a){return a.getDay()&&1!==a.getDate()}],["%-m/%-d",function(a){return 1!==a.getDate()}],["%-m/%-d",function(a){return a.getMonth()}],["%Y/%-m/%-d",function(){return!0}]]),a.hiddenTargetIds=[],a.hiddenLegendIds=[],a.xOrient=c[vb]?"left":"bottom",a.yOrient=c[vb]?"bottom":"left",a.y2Orient=c[vb]?"top":"right",a.subXOrient=c[vb]?"left":"bottom",a.isLegendRight="right"===c[mb],a.isLegendInset="inset"===c[mb],a.isLegendTop="top-left"===c[nb]||"top-right"===c[nb],a.isLegendLeft="top-left"===c[nb]||"bottom-left"===c[nb],a.legendStep=0,a.legendItemWidth=0,a.legendItemHeight=0,a.legendOpacityForHidden=.15,a.currentMaxTickWidth=0,a.rotated_padding_left=30,a.rotated_padding_right=c[vb]&&!c[wb]?0:30,a.rotated_padding_top=5,a.withoutFadeIn={},a.axes.subx=b.selectAll([])},f.initWithData=function(b){var c,d=this,e=d.d3,f=d.config,g=!0;d.initPie&&d.initPie(),d.initBrush&&d.initBrush(),d.initZoom&&d.initZoom(),d.selectChart=e.select(f[h]),d.selectChart.empty()&&(d.selectChart=e.select(document.createElement("div")).style("opacity",0),d.observeInserted(d.selectChart),g=!1),d.selectChart.html("").classed("c3",!0),d.data.xs={},d.data.targets=d.convertDataToTargets(b),f[P]&&(d.data.targets=d.data.targets.filter(f[P])),f[O]&&d.addHiddenTargetIds(f[O]===!0?d.mapToIds(d.data.targets):f[O]),d.hasType("gauge")&&(f[lb]=!1),d.updateSizes(),d.updateScales(),d.x.domain(e.extent(d.getXDomain(d.data.targets))),d.y.domain(d.getYDomain(d.data.targets,"y")),d.y2.domain(d.getYDomain(d.data.targets,"y2")),d.subX.domain(d.x.domain()),d.subY.domain(d.y.domain()),d.subY2.domain(d.y2.domain()),d.orgXDomain=d.x.domain(),d.brush&&d.brush.scale(d.subX),f[o]&&d.zoom.scale(d.x),d.svg=d.selectChart.append("svg").style("overflow","hidden").on("mouseenter",function(){return f[t].call(d)}).on("mouseleave",function(){return f[u].call(d)}),d.defs=d.svg.append("defs"),d.defs.append("clipPath").attr("id",d.clipId).append("rect"),d.defs.append("clipPath").attr("id",d.clipIdForXAxis).append("rect"),d.defs.append("clipPath").attr("id",d.clipIdForYAxis).append("rect"),d.updateSvgSize(),c=d.main=d.svg.append("g").attr("transform",d.getTranslate("main")),d.initSubchart&&d.initSubchart(),d.initTooltip&&d.initTooltip(),d.initLegend&&d.initLegend(),c.append("text").attr("class",pe[Nd]+" "+pe[Md]).attr("text-anchor","middle").attr("dominant-baseline","middle"),d.initRegion(),d.initGrid(),c.append("g").attr("clip-path",d.clipPath).attr("class",pe[_c]),d.initEventRect(),d.initBar&&d.initBar(),d.initLine&&d.initLine(),d.initArc&&d.initArc(),d.initGauge&&d.initGauge(),d.initText&&d.initText(),c.insert("rect",f[q]?null:"g."+pe[xd]).attr("class",pe[td]).attr("width",d.width).attr("height",d.height).style("opacity",0).on("dblclick.zoom",null),f[Nb]&&d.brush.extent(re(f[Nb])?f[Nb](d.getXDomain()):f[Nb]),d.initAxis(),d.updateTargets(d.data.targets),g&&(d.updateDimension(),d.redraw({withTransform:!0,withUpdateXDomain:!0,withUpdateOrgXDomain:!0,withTransitionForAxis:!1})),null==a.onresize&&(a.onresize=d.generateResize()),a.onresize.add&&(a.onresize.add(function(){f[v].call(d)}),a.onresize.add(function(){d.api.flush()}),a.onresize.add(function(){f[w].call(d)})),d.api.element=d.selectChart.node()},f.smoothLines=function(a,b){var c=this;"grid"===b&&a.each(function(){var a=c.d3.select(this),b=a.attr("x1"),d=a.attr("x2"),e=a.attr("y1"),f=a.attr("y2");a.attr({x1:Math.ceil(b),x2:Math.ceil(d),y1:Math.ceil(e),y2:Math.ceil(f)})})},f.updateSizes=function(){var a=this,b=a.config,c=a.legend?a.getLegendHeight():0,d=a.legend?a.getLegendWidth():0,e=a.isLegendRight||a.isLegendInset?0:c,f=a.hasArcType(),g=b[vb]||f?0:a.getHorizontalAxisHeight("x"),h=b[gb]&&!f?b[hb]+g:0;a.currentWidth=a.getCurrentWidth(),a.currentHeight=a.getCurrentHeight(),b[vb]?(a.margin={top:a.getHorizontalAxisHeight("y2")+a.getCurrentPaddingTop(),right:f?0:a.getCurrentPaddingRight(),bottom:a.getHorizontalAxisHeight("y")+e+a.getCurrentPaddingBottom(),left:h+(f?0:a.getCurrentPaddingLeft())},a.margin2={top:a.margin.top,right:0/0,bottom:20+e,left:a.rotated_padding_left}):(a.margin={top:4+a.getCurrentPaddingTop(),right:f?0:a.getCurrentPaddingRight(),bottom:g+h+e+a.getCurrentPaddingBottom(),left:f?0:a.getCurrentPaddingLeft()},a.margin2={top:a.currentHeight-h-e,right:0/0,bottom:g+e,left:a.margin.left}),a.updateSizeForLegend&&a.updateSizeForLegend(c,d),a.width=a.currentWidth-a.margin.left-a.margin.right,a.height=a.currentHeight-a.margin.top-a.margin.bottom,a.width<0&&(a.width=0),a.height<0&&(a.height=0),a.width2=b[vb]?a.margin.left-a.rotated_padding_left-a.rotated_padding_right:a.width,a.height2=b[vb]?a.height:a.currentHeight-a.margin2.top-a.margin2.bottom,a.width2<0&&(a.width2=0),a.height2<0&&(a.height2=0),a.arcWidth=a.width-(a.isLegendRight?d+10:0),a.arcHeight=a.height-(a.isLegendRight?0:10),a.updateRadius&&a.updateRadius(),a.isLegendRight&&f&&(a.margin3.left=a.arcWidth/2+1.1*a.radiusExpanded)},f.updateTargets=function(a){var b=this,c=b.config;b.updateTargetsForText(a),b.updateTargetsForBar(a),b.updateTargetsForLine(a),b.updateTargetsForArc&&b.updateTargetsForArc(a),b.updateTargetsForSubchart&&b.updateTargetsForSubchart(a),b.svg.selectAll("."+pe[$c]).filter(function(a){return b.isTargetToShow(a.id)}).transition().duration(c[x]).style("opacity",1)},f.redraw=function(a,b){var c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,t,u,v,w,y,z=this,A=z.main,B=z.d3,C=z.config,D=z.getShapeIndices(z.isAreaType),E=z.getShapeIndices(z.isBarType),F=z.getShapeIndices(z.isLineType),G=z.hasArcType(),H=z.filterTargetsToShow(z.data.targets),I=z.xv.bind(z),J=(z.config[vb]?z.circleY:z.circleX).bind(z),K=(z.config[vb]?z.circleX:z.circleY).bind(z);if(a=a||{},c=Ae(a,"withY",!0),d=Ae(a,"withSubchart",!0),e=Ae(a,"withTransition",!0),h=Ae(a,"withTransform",!1),i=Ae(a,"withUpdateXDomain",!1),j=Ae(a,"withUpdateOrgXDomain",!1),k=Ae(a,"withLegend",!1),f=Ae(a,"withTransitionForExit",e),g=Ae(a,"withTransitionForAxis",e),q=e?C[x]:0,r=f?q:0,t=g?q:0,b=b||z.generateAxisTransitions(t),k&&C[lb]&&z.updateLegend(z.mapToIds(z.data.targets),a,b),z.isCategorized()&&0===H.length&&z.x.domain([0,z.axes.x.selectAll(".tick").size()]),H.length?(z.updateXDomain(H,i,j),C[Gb]||!C[Fb]&&!C[Eb]||(v=z.generateTickValues(z.mapTargetsToUniqueXs(H),C[Eb]),z.xAxis.tickValues(v),z.subXAxis.tickValues(v))):(z.xAxis.tickValues([]),z.subXAxis.tickValues([])),z.y.domain(z.getYDomain(H,"y")),z.y2.domain(z.getYDomain(H,"y2")),z.redrawAxis(b,G),z.updateAxisLabels(e),i&&H.length)if(C[Cb]&&v){for(w=1;w<v.length;w++)if(v.length/w<C[Db]){y=w;break}z.svg.selectAll("."+pe[_d]+" .tick text").each(function(a){var b=v.indexOf(a);b>=0&&B.select(this).style("display",b%y?"none":"block")})}else z.svg.selectAll("."+pe[_d]+" .tick text").style("display","block");!C[vb]&&C[Hb]&&z.rotateTickText(z.axes.x,b.axisX,C[Hb]),l=z.generateDrawArea?z.generateDrawArea(D,!1):void 0,m=z.generateDrawBar?z.generateDrawBar(E):void 0,n=z.generateDrawLine?z.generateDrawLine(F,!1):void 0,o=z.generateXYForText(E,!0),p=z.generateXYForText(E,!1),z.subY.domain(z.y.domain()),z.subY2.domain(z.y2.domain()),z.tooltip.style("display","none"),z.updateXgridFocus(),A.select("text."+pe[Nd]+"."+pe[Md]).attr("x",z.width/2).attr("y",z.height/2).text(C[fb]).transition().style("opacity",H.length?0:1),z.redrawGrid(q,c),z.redrawRegion(q),z.redrawBar(r),z.redrawLine(r),z.redrawArea(r),C[mc]&&z.redrawCircle(),z.hasDataLabel()&&z.redrawText(r),z.redrawArc&&z.redrawArc(q,r,h),z.redrawSubchart&&z.redrawSubchart(d,b,q,r,D,E,F),A.selectAll("."+pe[od]).filter(z.isBarType.bind(z)).selectAll("circle").remove(),C[s]&&z.redrawEventRect(),B.transition().duration(q).each(function(){var b=[];z.addTransitionForBar(b,m),z.addTransitionForLine(b,n),z.addTransitionForArea(b,l),z.addTransitionForCircle(b,J,K),z.addTransitionForText(b,o,p,a.flow),z.addTransitionForRegion(b),z.addTransitionForGrid(b),a.flow&&(u=z.generateWait(),b.forEach(function(a){u.add(a)}))}).call(u?u:function(){},function(){var b,c,d,e=1,f=a.flow.index,g=a.flow.length,h=z.getValueOnIndex(z.data.targets[0].values,f),i=z.getValueOnIndex(z.data.targets[0].values,f+g),j=z.x.domain(),k=a.flow.duration||q,r=a.flow.done||function(){},s=z.generateWait(),t=z.xgrid||B.selectAll([]),u=z.xgridLines||B.selectAll([]),v=z.mainRegion||B.selectAll([]),w=z.mainText||B.selectAll([]),x=z.mainBar||B.selectAll([]),y=z.mainLine||B.selectAll([]),A=z.mainArea||B.selectAll([]),D=z.mainCircle||B.selectAll([]);z.data.targets.forEach(function(a){a.values.splice(0,g)}),d=z.updateXDomain(H,!0,!0),z.updateXGrid&&z.updateXGrid(!0),a.flow.orgDataCount?b=1===a.flow.orgDataCount||h.x===i.x?z.x(j[0])-z.x(d[0]):z.isTimeSeries()?z.x(j[0])-z.x(d[0]):z.x(h.x)-z.x(i.x):1!==z.data.targets[0].values.length?b=z.x(j[0])-z.x(d[0]):z.isTimeSeries()?(h=z.getValueOnIndex(z.data.targets[0].values,0),i=z.getValueOnIndex(z.data.targets[0].values,z.data.targets[0].values.length-1),b=z.x(h.x)-z.x(i.x)):b=xe(d)/2,e=xe(j)/xe(d),c="translate("+b+",0) scale("+e+",1)",B.transition().ease("linear").duration(k).each(function(){s.add(z.axes.x.transition().call(z.xAxis)),s.add(x.transition().attr("transform",c)),s.add(y.transition().attr("transform",c)),s.add(A.transition().attr("transform",c)),s.add(D.transition().attr("transform",c)),s.add(w.transition().attr("transform",c)),s.add(v.filter(z.isRegionOnX).transition().attr("transform",c)),s.add(t.transition().attr("transform",c)),s.add(u.transition().attr("transform",c))}).call(s,function(){var a,b=[],c=[],d=[];if(g){for(a=0;g>a;a++)b.push("."+pe[Ad]+"-"+(f+a)),c.push("."+pe[Nd]+"-"+(f+a)),d.push("."+pe[pd]+"-"+(f+a));z.svg.selectAll("."+pe[Bd]).selectAll(b).remove(),z.svg.selectAll("."+pe[Od]).selectAll(c).remove(),z.svg.selectAll("."+pe[qd]).selectAll(d).remove(),z.svg.select("."+pe[Rd]).remove()}t.attr("transform",null).attr(z.xgridAttr),u.attr("transform",null),u.select("line").attr("x1",C[vb]?0:I).attr("x2",C[vb]?z.width:I),u.select("text").attr("x",C[vb]?z.width:0).attr("y",I),x.attr("transform",null).attr("d",m),y.attr("transform",null).attr("d",n),A.attr("transform",null).attr("d",l),D.attr("transform",null).attr("cx",J).attr("cy",K),w.attr("transform",null).attr("x",o).attr("y",p).style("fill-opacity",z.opacityForText.bind(z)),v.attr("transform",null),v.select("rect").filter(z.isRegionOnX).attr("x",z.regionX.bind(z)).attr("width",z.regionWidth.bind(z)),z.updateEventRect(),r()})}),z.mapToIds(z.data.targets).forEach(function(a){z.withoutFadeIn[a]=!0}),z.updateZoom&&z.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.isTimeSeries=function(){return"timeseries"===this.config[xb]},f.isCategorized=function(){return this.config[xb].indexOf("categor")>=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",a.getXAxisClipX.bind(a)).attr("y",a.getXAxisClipY.bind(a)).attr("width",a.getXAxisClipWidth.bind(a)).attr("height",a.getXAxisClipHeight.bind(a)),a.svg.select("#"+a.clipIdForYAxis).select("rect").attr("x",a.getYAxisClipX.bind(a)).attr("y",a.getYAxisClipY.bind(a)).attr("width",a.getYAxisClipWidth.bind(a)).attr("height",a.getYAxisClipHeight.bind(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<i[F].length;b++)if(e=i[F][b].filter(function(a){return j.indexOf(a)>=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;c<e.length;c++)f=e[c],k[f]&&k[f].forEach(function(a,b){h.getAxisId(f)!==h.getAxisId(d)||!k[d]||g&&+a>0||(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<i[F].length;b++)if(e=i[F][b].filter(function(a){return j.indexOf(a)>=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<e.length;c++)f=e[c],k[f]&&k[f].forEach(function(a,b){h.getAxisId(f)!==h.getAxisId(d)||!k[d]||g&&0>+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&&a<b.length?b[a]:null},f.addXs=function(a){var b=this;Object.keys(a).forEach(function(c){b.config[z][c]=a[c]})},f.hasMultipleX=function(a){return this.d3.set(Object.keys(a).map(function(b){return a[b]})).size()>1},f.isMultipleX=function(){var a=this,b=a.config;return ze(b[z])&&a.hasMultipleX(b[z])},f.addName=function(a){var b,c=this;return a&&(b=c.config[D][a.id],a.name=b?b:a.id),a},f.getValueOnIndex=function(a,b){var c=a.filter(function(a){return a.index===b});return c.length?c[0]:null},f.updateTargetX=function(a,b){var c=this;a.forEach(function(a){a.values.forEach(function(d,e){d.x=c.generateTargetX(b[e],a.id,e)}),c.data.xs[a.id]=b})},f.updateTargetXs=function(a,b){var c=this;a.forEach(function(a){b[a.id]&&c.updateTargetX([a],b[a.id])})},f.generateTargetX=function(a,b,c){var d,e=this;return d=e.isTimeSeries()?e.parseDate(a?a:e.getXValue(b,c)):e.isCustomX()&&!e.isCategorized()?qe(a)?+a:e.getXValue(b,c):c},f.cloneTarget=function(a){return{id:a.id,id_org:a.id_org,values:a.values.map(function(a){return{x:a.x,value:a.value,id:a.id}})}},f.getPrevX=function(a){var b=this,c=b.getValueOnIndex(b.data.targets[0].values,a-1);return c?c.x:null},f.getNextX=function(a){var b=this,c=b.getValueOnIndex(b.data.targets[0].values,a+1); |
|
return c?c.x:null},f.getMaxDataCount=function(){var a=this;return a.d3.max(a.data.targets,function(a){return a.values.length})},f.getMaxDataCountTarget=function(a){var b,c=a.length,d=0;return c>1?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;c<d.length;c++)if(d[c]===b)return!0;return!1},f.isTargetToShow=function(a){return this.hiddenTargetIds.indexOf(a)<0},f.isLegendToShow=function(a){return this.hiddenLegendIds.indexOf(a)<0},f.filterTargetsToShow=function(a){var b=this;return a.filter(function(a){return b.isTargetToShow(a.id)})},f.mapTargetsToUniqueXs=function(a){var b=this,c=b.d3.set(b.d3.merge(a.map(function(a){return a.values.map(function(a){return a.x})}))).values();return c.map(b.isTimeSeries()?function(a){return new Date(a)}:function(a){return+a})},f.addHiddenTargetIds=function(a){this.hiddenTargetIds=this.hiddenTargetIds.concat(a)},f.removeHiddenTargetIds=function(a){this.hiddenTargetIds=this.hiddenTargetIds.filter(function(b){return a.indexOf(b)<0})},f.addHiddenLegendIds=function(a){this.hiddenLegendIds=this.hiddenLegendIds.concat(a)},f.removeHiddenLegendIds=function(a){this.hiddenLegendIds=this.hiddenLegendIds.filter(function(b){return a.indexOf(b)<0})},f.getValuesAsIdKeyed=function(a){var b={};return a.forEach(function(a){b[a.id]=[],a.values.forEach(function(c){b[a.id].push(c.value)})}),b},f.checkValueInTargets=function(a,b){var c,d,e,f=Object.keys(a);for(c=0;c<f.length;c++)for(e=a[f[c]].values,d=0;d<e.length;d++)if(b(e[d].value))return!0;return!1},f.hasNegativeValueInTargets=function(a){return this.checkValueInTargets(a,function(a){return 0>a})},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;c<a.length&&d===a[c].x;c++)e.push(a[c]);return e},f.findClosestOfValues=function(a,b,c,d){var e,f=this,g=c?c:0,h=d?d:a.length-1,i=Math.floor((h-g)/2)+g,j=a[i],k=f.x(j.x)-b[f.config[vb]?1:0];return k>0?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<a.length;b++){for(e={},c=0;c<a[b].length;c++){if(te(a[b][c]))throw new Error("Source data is missing a component at ("+b+","+c+")!");e[d[c]]=a[b][c]}f.push(e)}return f},f.convertColumnsToData=function(a){var b,c,d,e=[];for(b=0;b<a.length;b++)for(d=a[b][0],c=1;c<a[b].length;c++){if(te(e[c-1])&&(e[c-1]={}),te(a[b][c]))throw new Error("Source data is missing a component at ("+b+","+c+")!");e[c-1][d]=a[b][c]}return e},f.convertDataToTargets=function(a,b){var c,d=this,e=d.config,f=d.d3.keys(a[0]).filter(d.isNotX,d),g=d.d3.keys(a[0]).filter(d.isX,d);return f.forEach(function(c){var f=d.getXKey(c);d.isCustomX()||d.isTimeSeries()?g.indexOf(f)>=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;c<a.length;c++)if(b.id===a[c].id){b.values=a[c].values,a.splice(c,1);break}}),c.data.targets=c.data.targets.concat(a)),c.updateTargets(c.data.targets),c.redraw({withUpdateOrgXDomain:!0,withUpdateXDomain:!0,withLegend:!0}),b.done&&b.done()},f.loadFromArgs=function(a){var b=this;a.data?b.load(b.convertDataToTargets(a.data),a):a.url?b.convertUrlToData(a.url,a.mimeType,a.keys,function(c){b.load(b.convertDataToTargets(c),a)}):a.json?b.load(b.convertDataToTargets(b.convertJsonToData(a.json,a.keys)),a):a.rows?b.load(b.convertDataToTargets(b.convertRowsToData(a.rows)),a):a.columns?b.load(b.convertDataToTargets(b.convertColumnsToData(a.columns)),a):b.load(null,a)},f.unload=function(a,b){var c=this;return b||(b=function(){}),a=a.filter(function(a){return c.hasTarget(c.data.targets,a)}),a&&0!==a.length?(c.svg.selectAll(a.map(function(a){return c.selectorTarget(a)})).transition().style("opacity",0).remove().call(c.endall,b),void a.forEach(function(a){c.withoutFadeIn[a]=!1,c.legend&&c.legend.selectAll("."+pe[ge]+c.getTargetSelectorSuffix(a)).remove(),c.data.targets=c.data.targets.filter(function(b){return b.id!==a})})):void b()},f.categoryName=function(a){var b=this.config;return a<b[zb].length?b[zb][a]:a},f.initEventRect=function(){var a=this,b=a.CLASS;a.main.select("."+b[_c]).append("g").attr("class",b[qd]).style("fill-opacity",0)},f.redrawEventRect=function(){var a,b,c=this,d=c.config,e=c.CLASS,f=c.isMultipleX(),g=c.main.select("."+e[qd]).style("cursor",d[o]?d[vb]?"ns-resize":"ew-resize":null).classed(e[sd],f).classed(e[rd],!f);g.selectAll("."+e[pd]).remove(),c.eventRect=g.selectAll("."+e[pd]),f?(a=c.eventRect.data([0]),c.generateEventRectsForMultipleXs(a.enter()),c.updateEventRect(a)):(b=c.getMaxDataCountTarget(c.data.targets),g.datum(b?b.values:[]),c.eventRect=g.selectAll("."+e[pd]),a=c.eventRect.data(function(a){return a}),c.generateEventRectsForSingleX(a.enter()),c.updateEventRect(a),a.exit().remove())},f.updateEventRect=function(a){var b,c,d,e,f,g,h=this,i=h.config;a=a||h.eventRect.data(function(a){return a}),h.isMultipleX()?(b=0,c=0,d=h.width,e=h.height):(!h.isCustomX()&&!h.isTimeSeries()||h.isCategorized()?(f=h.getEventRectWidth(),g=function(a){return h.x(a.x)-f/2}):(f=function(a){var b=h.getPrevX(a.index),c=h.getNextX(a.index),d=h.data.xs[a.id][a.index],e=(h.x(c?c:d)-h.x(b?b:d))/2;return 0>e?0:e},g=function(a){var b=h.getPrevX(a.index),c=h.data.xs[a.id][a.index];return(h.x(c)+h.x(b?b:c))/2}),b=i[vb]?0:g,c=i[vb]?g:0,d=i[vb]?h.width:f,e=i[vb]?f:h.height),a.attr("class",h.classEvent.bind(h)).attr("x",b).attr("y",c).attr("width",d).attr("height",e)},f.generateEventRectsForSingleX=function(a){var b=this,c=b.d3,d=b.config;a.append("rect").attr("class",b.classEvent.bind(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<c.length;b++)if(c[b]&&c[b].id===a){e.push(c[b]),c.shift(b);break}}),c=e.concat(c),d[oc]&&b.expandCircles(f),b.expandBars(f),b.main.selectAll("."+pe[Ad]+"-"+f).each(function(a){d[V].call(g,a)}))}).on("mouseout",function(a){var c=a.index;b.hasArcType()||(b.hideXGridFocus(),b.hideTooltip(),b.unexpandCircles(c),b.unexpandBars(),b.main.selectAll("."+pe[Ad]+"-"+c).each(function(a){d[W].call(b,a)}))}).on("mousemove",function(a){var e,f=a.index,g=b.svg.select("."+pe[pd]+"-"+f);b.dragging||b.hasArcType()||(e=b.filterTargetsToShow(b.data.targets).map(function(a){return b.addName(b.getValueOnIndex(a.values,f))}),d[Sc]&&(b.showTooltip(e,c.mouse(this)),b.showXGridFocus(e)),(!d[Sc]||d[Q]&&!d[R])&&b.main.selectAll("."+pe[Ad]+"-"+f).each(function(){c.select(this).classed(pe[me],!0),d[Q]&&g.style("cursor",d[R]?"pointer":null),d[Sc]||(b.hideXGridFocus(),b.hideTooltip(),d[R]||(b.unexpandCircles(f),b.unexpandBars()))}).filter(function(a){return"circle"===this.nodeName?b.isWithinCircle(this,b.pointSelectR(a)):"path"===this.nodeName?b.isWithinBar(this):void 0}).each(function(a){d[Q]&&(d[R]||d[S](a))&&g.style("cursor","pointer"),d[Sc]||(b.showTooltip([a],c.mouse(this)),b.showXGridFocus([a]),d[oc]&&b.expandCircles(f,a.id),b.expandBars(f,a.id))}))}).on("click",function(a){var c=a.index;if(!b.hasArcType()&&b.toggleShape)return b.cancelClick?void(b.cancelClick=!1):void b.main.selectAll("."+pe[Ad]+"-"+c).each(function(a){b.toggleShape(this,a,c)})}).call(c.behavior.drag().origin(Object).on("drag",function(){b.drag(c.mouse(this))}).on("dragstart",function(){b.dragstart(c.mouse(this))}).on("dragend",function(){b.dragend()})).on("dblclick.zoom",null)},f.generateEventRectsForMultipleXs=function(a){var b=this,c=b.d3,d=b.config;a.append("rect").attr("x",0).attr("y",0).attr("width",b.width).attr("height",b.height).attr("class",pe[pd]).on("mouseout",function(){b.hasArcType()||(b.hideXGridFocus(),b.hideTooltip(),b.unexpandCircles())}).on("mousemove",function(){var a,e,f,g,h=b.filterTargetsToShow(b.data.targets);b.dragging||b.hasArcType(h)||(a=c.mouse(this),e=b.findClosestFromTargets(h,a),e&&(f=b.isScatterType(e)?[e]:b.filterSameX(h,e.x),g=f.map(function(a){return b.addName(a)}),b.showTooltip(g,a),d[oc]&&(b.unexpandCircles(),b.expandCircles(e.index,e.id)),b.showXGridFocus(g),b.dist(e,a)<100?(b.svg.select("."+pe[pd]).style("cursor","pointer"),b.mouseover||(d[V].call(b,e),b.mouseover=!0)):b.mouseover&&(b.svg.select("."+pe[pd]).style("cursor",null),d[W].call(b,e),b.mouseover=!1)))}).on("click",function(){var a,d,e=b.filterTargetsToShow(b.data.targets);b.hasArcType(e)||(a=c.mouse(this),d=b.findClosestFromTargets(e,a),d&&b.dist(d,a)<100&&b.toggleShape&&b.main.select("."+pe[Hd]+b.getTargetSelectorSuffix(d.id)).select("."+pe[Gd]+"-"+d.index).each(function(){b.toggleShape(this,d,d.index)}))}).call(c.behavior.drag().origin(Object).on("drag",function(){b.drag(c.mouse(this))}).on("dragstart",function(){b.dragstart(c.mouse(this))}).on("dragend",function(){b.dragend()})).on("dblclick.zoom",null)},f.getCurrentWidth=function(){var a=this,b=a.config;return b[i]?b[i]:a.getParentWidth()},f.getCurrentHeight=function(){var a=this,b=a.config,c=b[j]?b[j]:a.getParentHeight();return c>0?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<e[F].length;b++)if(!(e[F][b].indexOf(a.id)<0))for(c=0;c<e[F][b].length;c++)if(e[F][b][c]in f){f[a.id]=f[e[F][b][c]];break}te(f[a.id])&&(f[a.id]=g++)}),f.__max__=g-1,f},f.getShapeX=function(a,b,c,d){var e=this,f=d?e.subX:e.x;return function(d){var e=d.id in c?c[d.id]:0;return d.x||0===d.x?f(d.x)-a*(b/2-e):0}},f.getShapeY=function(a){var b=this;return function(c){var d=a?b.getSubYScale(c.id):b.getYScale(c.id);return d(c.value)}},f.getShapeOffset=function(a,b,c){var d=this,e=d.orderTargets(d.filterTargetsToShow(d.data.targets.filter(a,d))),f=e.map(function(a){return a.id});return function(a,g){var h=c?d.getSubYScale(a.id):d.getYScale(a.id),i=h(0),j=i;return e.forEach(function(c){c.id!==a.id&&b[c.id]===b[a.id]&&f.indexOf(c.id)<f.indexOf(a.id)&&c.values[g].value*a.value>=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.initLine=function(){var a=this,b=a.CLASS;a.main.select("."+b[_c]).append("g").attr("class",b[bd])},f.updateTargetsForLine=function(a){var b,c,d=this,e=d.config,f=d.CLASS,g=d.classChartLine.bind(d),h=d.classLines.bind(d),i=d.classAreas.bind(d),j=d.classCircles.bind(d);b=d.main.select("."+f[bd]).selectAll("."+f[ad]).data(a).attr("class",g),c=b.enter().append("g").attr("class",g).style("opacity",0).style("pointer-events","none"),c.append("g").attr("class",h),c.append("g").attr("class",i),c.append("g").attr("class",function(a){return d.generateClass(f[od],a.id)}),c.append("g").attr("class",j).style("cursor",function(a){return e[S](a)?"pointer":null}),a.forEach(function(a){d.main.selectAll("."+f[od]+d.getTargetSelectorSuffix(a.id)).selectAll("."+f[nd]).each(function(b){b.value=a.values[b.index].value})})},f.redrawLine=function(a){var b=this,c=b.CLASS;b.mainLine=b.main.selectAll("."+c[Dd]).selectAll("."+c[Cd]).data(b.lineData.bind(b)),b.mainLine.enter().append("path").attr("class",b.classLine.bind(b)).style("stroke",b.color),b.mainLine.style("opacity",b.initialOpacity.bind(b)).attr("transform",null),b.mainLine.exit().transition().duration(a).style("opacity",0).remove()},f.addTransitionForLine=function(a,b){var c=this;a.push(c.mainLine.transition().attr("d",b).style("stroke",c.color).style("opacity",1))},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.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]&&(0<a.value&&e>l||a.value<0&&l>e)&&(l=e),[[k,l-(e-j)]]}},f.lineWithRegions=function(a,b,c,d){function e(a,b){var c;for(c=0;c<b.length;c++)if(b[c].start<a&&a<=b[c].end)return!0;return!1}var f,g,h,i,j,k,l,m,n,o,p,q,r=this,s=r.config,t=-1,u="M",v=[];if(ue(d))for(f=0;f<d.length;f++)v[f]={},v[f].start=te(d[f].start)?a[0].x:r.isTimeSeries()?r.parseDate(d[f].start):d[f].start,v[f].end=te(d[f].end)?a[a.length-1].x:r.isTimeSeries()?r.parseDate(d[f].end):d[f].end;for(p=s[vb]?function(a){return c(a.value)}:function(a){return b(a.x)},q=s[vb]?function(a){return b(a.x)}:function(a){return c(a.value)},h=r.isTimeSeries()?function(a,d,e,f){var g=a.x.getTime(),h=d.x-a.x,i=new Date(g+h*e),k=new Date(g+h*(e+f));return"M"+b(i)+" "+c(j(e))+" "+b(k)+" "+c(j(e+f))}:function(a,d,e,f){return"M"+b(i(e),!0)+" "+c(j(e))+" "+b(i(e+f),!0)+" "+c(j(e+f))},f=0;f<a.length;f++){if(te(v)||!e(a[f].x,v))u+=" "+p(a[f])+" "+q(a[f]);else for(i=r.getScale(a[f-1].x,a[f].x,r.isTimeSeries()),j=r.getScale(a[f-1].value,a[f].value),k=b(a[f].x)-b(a[f-1].x),l=c(a[f].value)-c(a[f-1].value),m=Math.sqrt(Math.pow(k,2)+Math.pow(l,2)),n=2/m,o=2*n,g=n;1>=g;g+=o)u+=h(a[f-1],a[f],g,n);t=a[f].x}return u},f.redrawArea=function(a){var b=this,c=b.CLASS,d=b.d3;b.mainArea=b.main.selectAll("."+c[Ld]).selectAll("."+c[Kd]).data(b.lineData.bind(b)),b.mainArea.enter().append("path").attr("class",b.classArea.bind(b)).style("fill",b.color).style("opacity",function(){return b.orgAreaOpacity=+d.select(this).style("opacity"),0}),b.mainArea.style("opacity",b.orgAreaOpacity),b.mainArea.exit().transition().duration(a).style("opacity",0).remove()},f.addTransitionForArea=function(a,b){var c=this;a.push(c.mainArea.transition().attr("d",b).style("fill",c.color).style("opacity",c.orgAreaOpacity))},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.generateGetAreaPoint=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.isAreaType,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]&&(0<a.value&&e>l||a.value<0&&l>e)&&(l=e),[[k,j],[k,l-(e-j)]]}},f.redrawCircle=function(){var a=this,b=a.CLASS;a.mainCircle=a.main.selectAll("."+b[Hd]).selectAll("."+b[Gd]).data(a.lineOrScatterData.bind(a)),a.mainCircle.enter().append("circle").attr("class",a.classCircle.bind(a)).attr("r",a.pointR.bind(a)).style("fill",a.color),a.mainCircle.style("opacity",a.initialOpacity.bind(a)),a.mainCircle.exit().remove()},f.addTransitionForCircle=function(a,b,c){var d=this;a.push(d.mainCircle.transition().style("opacity",d.opacityForCircle.bind(d)).style("fill",d.color).attr("cx",b).attr("cy",c)),a.push(d.main.selectAll("."+pe[nd]).transition().attr("cx",b).attr("cy",c))},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,d=c.pointExpandedR.bind(c);c.getCircles(a,b).classed(pe[me],!0).attr("r",d)},f.unexpandCircles=function(a){var b=this,c=b.pointR.bind(b);b.getCircles(a).filter(function(){return b.d3.select(this).classed(pe[me])}).classed(pe[me],!1).attr("r",c)},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.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))<b},f.initBar=function(){var a=this,b=a.CLASS;a.main.select("."+b[_c]).append("g").attr("class",b[dd])},f.updateTargetsForBar=function(a){var b,c,d=this,e=d.config,f=d.CLASS,g=d.classChartBar.bind(d),h=d.classBars.bind(d);b=d.main.select("."+f[dd]).selectAll("."+f[cd]).data(a).attr("class",g),c=b.enter().append("g").attr("class",g).style("opacity",0).style("pointer-events","none"),c.append("g").attr("class",h).style("cursor",function(a){return e[S](a)?"pointer":null})},f.redrawBar=function(a){var b=this,c=b.CLASS,d=b.barData.bind(b),e=b.classBar.bind(b),f=b.initialOpacity.bind(b),g=function(a){return b.color(a.id)};b.mainBar=b.main.selectAll("."+c[Fd]).selectAll("."+c[Ed]).data(d),b.mainBar.enter().append("path").attr("class",e).style("stroke",g).style("fill",g),b.mainBar.style("opacity",f),b.mainBar.exit().transition().duration(a).style("opacity",0).remove()},f.addTransitionForBar=function(a,b){var c=this;a.push(c.mainBar.transition().attr("d",b).style("fill",c.color).style("opacity",1))},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]&&(0<a.value&&d>l||a.value<0&&l>d)&&(l=d),[[k,j],[k,l-(d-j)],[k+e,l-(d-j)],[k+e,j]]}},f.isWithinBar=function(a){var b=this.d3,c=b.mouse(a),d=a.getBoundingClientRect(),e=a.pathSegList.getItem(0),f=a.pathSegList.getItem(1),g=e.x,h=Math.min(e.y,f.y),i=d.width,j=d.height,k=2,l=g-k,m=g+i+k,n=h+j+k,o=h-k;return l<c[0]&&c[0]<m&&o<c[1]&&c[1]<n},f.initText=function(){var a=this,b=a.CLASS;a.main.select("."+b[_c]).append("g").attr("class",b[fd]),a.mainText=a.d3.selectAll([])},f.updateTargetsForText=function(a){var b,c,d=this,e=d.CLASS,f=d.classChartText.bind(d),g=d.classTexts.bind(d);b=d.main.select("."+e[fd]).selectAll("."+e[ed]).data(a).attr("class",f),c=b.enter().append("g").attr("class",f).style("opacity",0).style("pointer-events","none"),c.append("g").attr("class",g)},f.redrawText=function(a){var b=this,c=b.config,d=b.CLASS,e=b.barOrLineData.bind(b),f=b.classText.bind(b);b.mainText=b.main.selectAll("."+d[Od]).selectAll("."+d[Nd]).data(e),b.mainText.enter().append("text").attr("class",f).attr("text-anchor",function(a){return c[vb]?a.value<0?"end":"start":"middle"}).style("stroke","none").style("fill",function(a){return b.color(a)}).style("fill-opacity",0),b.mainText.text(function(a){return b.formatByAxisId(b.getAxisId(a.id))(a.value,a.id)}),b.mainText.exit().transition().duration(a).style("fill-opacity",0).remove()},f.addTransitionForText=function(a,b,c,d){var e=this,f=d?0:e.opacityForText.bind(e);a.push(e.mainText.transition().attr("x",b).attr("y",c).style("fill",e.color).style("fill-opacity",f))},f.getTextRect=function(a,b){var c;return this.d3.select("body").selectAll(".dummy").data([a]).enter().append("text").classed(b?b:"",!0).text(a).each(function(){c=this.getBoundingClientRect()}).remove(),c},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),d<f.height?f.height:d},f.setTargetType=function(a,b){var c=this,d=c.config;c.mapToTargetIds(a).forEach(function(a){c.withoutFadeIn[a]=b===d[I][a],d[I][a]=b}),a||(d[H]=b)},f.hasType=function(a,b){var c=this,d=c.config[I],e=!1;return(b||c.data.targets).forEach(function(b){(d[b.id]&&d[b.id].indexOf(a)>=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=f.yv.bind(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=b.xv.bind(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)}),e=b.main.selectAll("line."+pe[Vd]),f=b.xx.bind(b);c[Rc]&&(b.hasType("scatter")||b.hasArcType()||(e.style("visibility","visible").data([d[0]]).attr(c[vb]?"y1":"x1",f).attr(c[vb]?"y2":"x2",f),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<b.data.targets[0].values.length&&b.data.targets[0].values[a].x-c[Yc]!==0;a++);c[Yc]=a}b.tooltip.html(c[Wc].call(b,b.data.targets.map(function(a){return b.addName(a.values[c[Yc]])}),b.getXAxisTickFormat(),b.getYFormat(b.hasArcType()),b.color)),b.tooltip.style("top",c[Zc].top).style("left",c[Zc].left).style("display","block")}},f.getTooltipContent=function(a,b,c,d){var e,f,g,h,i,j,k=this,l=k.config,m=l[Tc]||b,n=l[Uc]||function(a){return a},o=l[Vc]||c;for(f=0;f<a.length;f++)a[f]&&(a[f].value||0===a[f].value)&&(e||(g=m?m(a[f].x):a[f].x,e="<table class='"+pe[yd]+"'>"+(g||0===g?"<tr><th colspan='2'>"+g+"</th></tr>":"")),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+="<tr class='"+pe[zd]+"-"+a[f].id+"'>",e+="<td class='name'><span style='background-color:"+j+"'></span>"+i+"</td>",e+="<td class='value'>"+h+"</td>",e+="</tr>");return e+"</table>"},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",a.textAnchorForXAxisLabel.bind(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",a.textAnchorForYAxisLabel.bind(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",a.textAnchorForY2AxisLabel.bind(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]&&(re(b[Bb])?c=b[Bb]:a.isTimeSeries()&&(c=function(c){return c?a.axisTimeFormat(b[Bb])(c):""})),re(c)?function(b){return c.call(a,b)}:c},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<a.width&&(g=a.width)})}).remove()),e.currentMaxTickWidth=0>=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",b.xForXAxisLabel.bind(b)).attr("dx",b.dxForXAxisLabel.bind(b)).attr("dy",b.dyForXAxisLabel.bind(b)).text(b.textForXAxisLabel.bind(b)),(a?d.transition():d).attr("x",b.xForYAxisLabel.bind(b)).attr("dx",b.dxForYAxisLabel.bind(b)).attr("dy",b.dyForYAxisLabel.bind(b)).text(b.textForYAxisLabel.bind(b)),(a?e.transition():e).attr("x",b.xForY2AxisLabel.bind(b)).attr("dx",b.dxForY2AxisLabel.bind(b)).attr("dy",b.dyForY2AxisLabel.bind(b)).text(b.textForY2AxisLabel.bind(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,f=d.classChartArc.bind(d),g=d.classArcs.bind(d);b=e.select("."+pe[hd]).selectAll("."+pe[gd]).data(d.pie(a)).attr("class",f),c=b.enter().append("g").attr("class",f),c.append("g").attr("class",g),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(e.arcData.bind(e)),d.enter().append("path").attr("class",e.classArc.bind(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(e.textForArcLabel.bind(e)).attr("transform",e.transformForArcLabel.bind(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",b.classRegion.bind(b)).append("rect").style("fill-opacity",0),b.mainRegion.exit().transition().duration(a).style("opacity",0).remove()},f.addTransitionForRegion=function(a){var b=this,c=b.regionX.bind(b),d=b.regionY.bind(b),e=b.regionWidth.bind(b),f=b.regionHeight.bind(b);a.push(b.mainRegion.selectAll("rect").transition().attr("x",c).attr("y",d).attr("width",e).attr("height",f).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=(e[vb]?d.circleY:d.circleX).bind(d),g=(e[vb]?d.circleX:d.circleY).bind(d),h=d.pointSelectR.bind(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",h)},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,i=f.classChartBar.bind(f),j=f.classBars.bind(f),k=f.classChartLine.bind(f),l=f.classLines.bind(f),m=f.classAreas.bind(f);h[gb]&&(e=g.select("."+pe[dd]).selectAll("."+pe[cd]).data(a).attr("class",i),d=e.enter().append("g").style("opacity",0).attr("class",i),d.append("g").attr("class",j),c=g.select("."+pe[bd]).selectAll("."+pe[ad]).data(a).attr("class",k),b=c.enter().append("g").style("opacity",0).attr("class",k),b.append("g").attr("class",l),b.append("g").attr("class",m))},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,r=n.barData.bind(n),s=n.lineData.bind(n),t=n.classBar.bind(n),u=n.classLine.bind(n),v=n.classArea.bind(n),w=n.initialOpacity.bind(n);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(r),j.enter().append("path").attr("class",t).style("stroke","none").style("fill",n.color),j.style("opacity",w).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(s),h.enter().append("path").attr("class",u).style("stroke",n.color),h.style("opacity",w).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(s),i.enter().append("path").attr("class",v).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;b<f.length;b++)if(d=e?a:100*a/g,d<f[b]){h=c[b];break}return h}:null},f.getYFormat=function(a){var b=this,c=a&&!b.hasType("gauge")?b.defaultArcValueFormat:b.yFormat,d=a&&!b.hasType("gauge")?b.defaultArcValueFormat:b.y2Format;return function(a,e,f){var g="y2"===b.getAxisId(f)?d:c;return g.call(b,a,e)}},f.yFormat=function(a){var b=this,c=b.config,d=c[Ub]?c[Ub]:b.defaultValueFormat;return d(a)},f.y2Format=function(a){var b=this,c=b.config,d=c[bc]?c[bc]:b.defaultValueFormat;return d(a)},f.defaultValueFormat=function(a){return qe(a)?+a:""},f.defaultArcValueFormat=function(a,b){return(100*b).toFixed(1)+"%"},f.formatByAxisId=function(a){var b=this,c=b.config[J],d=function(a){return qe(a)?+a:""};return c.format?d=c.format:"object"==typeof c.format&&c.format[a]&&(d=c.format[a]),d},f.hasCaches=function(a){for(var b=0;b<a.length;b++)if(!(a[b]in this.cache))return!1;return!0},f.addCache=function(a,b){this.cache[a]=this.cloneTarget(b)},f.getCaches=function(a){var b,c=[];for(b=0;b<a.length;b++)a[b]in this.cache&&c.push(this.cloneTarget(this.cache[a[b]]));return c};var $c="target",_c="chart ",ad="chartLine",bd="chartLines",cd="chartBar",dd="chartBars",ed="chartText",fd="chartTexts",gd="chartArc",hd="chartArcs",id="chartArcsTitle",jd="chartArcsBackground",kd="chartArcsGaugeUnit",ld="chartArcsGaugeMax",md="chartArcsGaugeMin",nd="selectedCircle",od="selectedCircles",pd="eventRect",qd="eventRects",rd="eventRectsSingle",sd="eventRectsMultiple",td="zoomRect",ud="brush",vd="focused",wd="region",xd="regions",yd="tooltip",zd="tooltipName",Ad="shape",Bd="shapes",Cd="line",Dd="lines",Ed="bar",Fd="bars",Gd="circle",Hd="circles",Id="arc",Jd="arcs",Kd="area",Ld="areas",Md="empty",Nd="text",Od="texts",Pd="gaugeValue",Qd="grid",Rd="xgrid",Sd="xgrids",Td="xgridLine",Ud="xgridLines",Vd="xgridFocus",Wd="ygrid",Xd="ygrids",Yd="ygridLine",Zd="ygridLines",$d="axis",_d="axisX",ae="axisXLabel",be="axisY",ce="axisYLabel",de="axisY2",ee="axisY2Label",fe="legendBackground",ge="legendItem",he="legendItemEvent",ie="legendItemTile",je="legendItemHidden",ke="legendItemFocused",le="dragarea",me="EXPANDED",ne="SELECTED",oe="INCLUDED",pe=f.CLASS={};pe[$c]="c3-target",pe[_c]="c3-chart",pe[ad]="c3-chart-line",pe[bd]="c3-chart-lines",pe[cd]="c3-chart-bar",pe[dd]="c3-chart-bars",pe[ed]="c3-chart-text",pe[fd]="c3-chart-texts",pe[gd]="c3-chart-arc",pe[hd]="c3-chart-arcs",pe[id]="c3-chart-arcs-title",pe[jd]="c3-chart-arcs-background",pe[kd]="c3-chart-arcs-gauge-unit",pe[ld]="c3-chart-arcs-gauge-max",pe[md]="c3-chart-arcs-gauge-min",pe[nd]="c3-selected-circle",pe[od]="c3-selected-circles",pe[pd]="c3-event-rect",pe[qd]="c3-event-rects",pe[rd]="c3-event-rects-single",pe[sd]="c3-event-rects-multiple",pe[td]="c3-zoom-rect",pe[ud]="c3-brush",pe[vd]="c3-focused",pe[wd]="c3-region",pe[xd]="c3-regions",pe[yd]="c3-tooltip",pe[zd]="c3-tooltip-name",pe[Ad]="c3-shape",pe[Bd]="c3-shapes",pe[Cd]="c3-line",pe[Dd]="c3-lines",pe[Ed]="c3-bar",pe[Fd]="c3-bars",pe[Gd]="c3-circle",pe[Hd]="c3-circles",pe[Id]="c3-arc",pe[Jd]="c3-arcs",pe[Kd]="c3-area",pe[Ld]="c3-areas",pe[Md]="c3-empty",pe[Nd]="c3-text",pe[Od]="c3-texts",pe[Pd]="c3-gauge-value",pe[Qd]="c3-grid",pe[Rd]="c3-xgrid",pe[Sd]="c3-xgrids",pe[Td]="c3-xgrid-line",pe[Ud]="c3-xgrid-lines",pe[Vd]="c3-xgrid-focus",pe[Wd]="c3-ygrid",pe[Xd]="c3-ygrids",pe[Yd]="c3-ygrid-line",pe[Zd]="c3-ygrid-lines",pe[$d]="c3-axis",pe[_d]="c3-axis-x",pe[ae]="c3-axis-x-label",pe[be]="c3-axis-y",pe[ce]="c3-axis-y-label",pe[de]="c3-axis-y2",pe[ee]="c3-axis-y2-label",pe[fe]="c3-legend-background",pe[ge]="c3-legend-item",pe[he]="c3-legend-item-event",pe[ie]="c3-legend-item-tile",pe[je]="c3-legend-item-hidden",pe[ke]="c3-legend-item-focused",pe[le]="c3-dragarea",pe[me]="_expanded_",pe[ne]="_selected_",pe[oe]="_included_",f.generateClass=function(a,b){return" "+a+" "+a+this.getTargetSelectorSuffix(b)},f.classText=function(a){return this.generateClass(pe[Nd],a.index)},f.classTexts=function(a){return this.generateClass(pe[Od],a.id)},f.classShape=function(a){return this.generateClass(pe[Ad],a.index)},f.classShapes=function(a){return this.generateClass(pe[Bd],a.id)},f.classLine=function(a){return this.classShape(a)+this.generateClass(pe[Cd],a.id)},f.classLines=function(a){return this.classShapes(a)+this.generateClass(pe[Dd],a.id)},f.classCircle=function(a){return this.classShape(a)+this.generateClass(pe[Gd],a.index)},f.classCircles=function(a){return this.classShapes(a)+this.generateClass(pe[Hd],a.id)},f.classBar=function(a){return this.classShape(a)+this.generateClass(pe[Ed],a.index)},f.classBars=function(a){return this.classShapes(a)+this.generateClass(pe[Fd],a.id)},f.classArc=function(a){return this.classShape(a.data)+this.generateClass(pe[Id],a.data.id)},f.classArcs=function(a){return this.classShapes(a.data)+this.generateClass(pe[Jd],a.data.id)},f.classArea=function(a){return this.classShape(a)+this.generateClass(pe[Kd],a.id)},f.classAreas=function(a){return this.classShapes(a)+this.generateClass(pe[Ld],a.id)},f.classRegion=function(a,b){return this.generateClass(pe[wd],b)+" "+("class"in a?a.class:"")},f.classEvent=function(a){return this.generateClass(pe[pd],a.index)},f.classTarget=function(a){var b=this,c=b.config[E][a],d="";return c&&(d=" "+pe[$c]+"-"+c),b.generateClass(pe[$c],a)+d},f.classChartText=function(a){return pe[ed]+this.classTarget(a.id)},f.classChartLine=function(a){return pe[ad]+this.classTarget(a.id)},f.classChartBar=function(a){return pe[cd]+this.classTarget(a.id)},f.classChartArc=function(a){return pe[gd]+this.classTarget(a.data.id)},f.getTargetSelectorSuffix=function(a){return a||0===a?"-"+(a.replace?a.replace(/([^a-zA-Z0-9-_])/g,"-"):a):""},f.selectorTarget=function(a){return"."+pe[$c]+this.getTargetSelectorSuffix(a)},f.selectorTargets=function(a){var b=this;return a.length?a.map(function(a){return b.selectorTarget(a)}):null},f.selectorLegend=function(a){return"."+pe[ge]+this.getTargetSelectorSuffix(a)},f.selectorLegends=function(a){var b=this;return a.length?a.map(function(a){return b.selectorLegend(a)}):null};var qe=f.isValue=function(a){return a||0===a},re=f.isFunction=function(a){return"function"==typeof a},se=f.isString=function(a){return"string"==typeof a},te=f.isUndefined=function(a){return"undefined"==typeof a},ue=f.isDefined=function(a){return"undefined"!=typeof a},ve=f.ceil10=function(a){return 10*Math.ceil(a/10)},we=f.asHalfPixel=function(a){return Math.ceil(a)+.5},xe=f.diffDomain=function(a){return a[1]-a[0]},ye=f.isEmpty=function(a){return!a||se(a)&&0===a.length||"object"==typeof a&&0===Object.keys(a).length},ze=f.notEmpty=function(a){return Object.keys(a).length>0},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}};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(c.isNoneArc.bind(c)),f=d.filter(c.isArc.bind(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(c.isNoneArc.bind(c)),f=d.filter(c.isArc.bind(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(c.isNoneArc.bind(c)),f=d.filter(c.isArc.bind(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;c<b.length;c++)if(a.id===b[c].id){for(e=!0,a.values[a.values.length-1]&&(n=a.values[a.values.length-1].index+1),m=b[c].values.length,d=0;m>d;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;b<k.length;b++)if(a.id===k[b])for(n=a.values[a.values.length-1].index+1,c=0;m>c;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.x<i&&m++})):ue(a.length)&&(m=a.length),l?1===l&&j.isTimeSeries()&&(h=(f.values[f.values.length-1].x-g.x)/2,e=[new Date(+g.x-h),new Date(+g.x+h)],j.updateXDomain(null,!0,!0,e)):(h=j.isTimeSeries()?f.values.length>1?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); |