|
|
|
!function(a){"use strict";function b(a){return a||0===a}function c(a){return"undefined"==typeof a}function d(a){return"undefined"!=typeof a}var e={version:"0.1.26"},f={target:"c3-target",chart:"c3-chart",chartLine:"c3-chart-line",chartLines:"c3-chart-lines",chartBar:"c3-chart-bar",chartBars:"c3-chart-bars",chartText:"c3-chart-text",chartTexts:"c3-chart-texts",chartArc:"c3-chart-arc",chartArcs:"c3-chart-arcs",chartArcsTitle:"c3-chart-arcs-title",selectedCircle:"c3-selected-circle",selectedCircles:"c3-selected-circles",eventRect:"c3-event-rect",eventRects:"c3-event-rects",zoomRect:"c3-zoom-rect",brush:"c3-brush",focused:"c3-focused",region:"c3-region",regions:"c3-regions",tooltip:"c3-tooltip",tooltipName:"c3-tooltip-name",shape:"c3-shape",shapes:"c3-shapes",line:"c3-line",bar:"c3-bar",bars:"c3-bars",circle:"c3-circle",circles:"c3-circles",arc:"c3-arc",area:"c3-area",text:"c3-text",texts:"c3-texts",grid:"c3-grid",xgrid:"c3-xgrid",xgrids:"c3-xgrids",xgridLine:"c3-xgrid-line",xgridLines:"c3-xgrid-lines",xgridFocus:"c3-xgrid-focus",ygrid:"c3-ygrid",ygrids:"c3-ygrids",ygridLine:"c3-ygrid-line",ygridLines:"c3-ygrid-lines",axisX:"c3-axis-x",axisXLabel:"c3-axis-x-label",axisY:"c3-axis-y",axisYLabel:"c3-axis-y-label",axisY2:"c3-axis-y2",axisY2Label:"c3-axis-y2-label",legendItem:"c3-legend-item",legendItemEvent:"c3-legend-item-event",legendItemTile:"c3-legend-item-tile",dragarea:"c3-dragarea",EXPANDED:"_expanded_",SELECTED:"_selected_",INCLUDED:"_included_"};e.generate=function(e){function g(a,b){if(!(a in e))throw Error(b)}function h(a,b){var c,d,f,g=e;for(c=0;c<a.length;c++){if("object"==typeof g&&!(a[c]in g))return b;if(d=c===a.length-1,f=g[a[c]],!d&&"object"!=typeof f||d&&"object"!=typeof b&&"object"==typeof f)return b;g=f}return g}function i(a){return"url("+document.URL.split("#")[0]+"#"+a+")"}function j(){gi.attr("transform",Th.main),gi.select("."+f.axisX).attr("transform",Th.x),gi.select("."+f.axisY).attr("transform",Th.y),gi.select("."+f.axisY2).attr("transform",Th.y2),gi.select("."+f.chartArcs).attr("transform",Th.arc)}function k(){kg&&(hi.attr("transform",Th.context),hi.select("."+f.axisX).attr("transform",Th.subx))}function l(a){var b=a!==!1?250:0;ng&&ii.transition().duration(b).attr("transform",Th.legend)}function m(a){j(a),k(a),l(a)}function n(){lf=q(),mf=r(),nf=P(),of=O(),df={top:rg?v("y2"):$h,right:t(),bottom:v(rg?"y":"x")+(rg?0:lg)+(Uh?0:nf),left:(rg?lg+Zh:0)+s()},gf=lf-df.left-df.right,jf=mf-df.top-df.bottom,0>gf&&(gf=0),0>jf&&(jf=0),ef={top:rg?df.top:mf-lg-(Uh?0:nf),right:0/0,bottom:20+(Uh?0:nf),left:rg?Yh:df.left},hf=rg?df.left-Yh-Zh:gf,kf=rg?jf:mf-ef.top-ef.bottom,0>hf&&(hf=0),0>kf&&(kf=0),ff={top:Uh?0:mf-nf,right:0/0,bottom:0,left:Uh?lf-of:0},o(),Uh&&Hd(Se.data.targets)&&(ff.left=gf/2+qf)}function o(){qf=jf/2,pf=.95*qf,rf=Gd(Se.data.targets)?.6*pf:0}function p(){var a=rg?f.axisX:f.axisY,b=Re.select("."+a).node(),c=b?b.getBoundingClientRect():{right:0},d=Re.select(Ue).node().getBoundingClientRect(),e=c.right-d.left-s();return e>0?e:0}function q(){return Ve?Ve:w()}function r(){var a=We?We:x();return a>0?a:320}function s(){return Hd(Se.data.targets)?0:Xe?Xe:rg||!Cg||Hg?1:u("y")}function t(){var a=1;return Hd(Se.data.targets)?0:Ye?Ye:Uh?of+(Lg&&!rg?u("y2"):a):Lg?Qg||rg?a:u("y2"):a}function u(a){var b=gb(a);return b.isInner?20+zb(a):40+zb(a)}function v(a){return"y"!==a||Cg?"y2"!==a||Lg?(gb(a).isInner?30:40)+("y2"===a?-10:0):$h:ng&&!Uh?10:1}function w(){return+Re.select(Ue).style("width").replace("px","")}function x(){return+Re.select(Ue).style("height").replace("px","")}function y(a){return a?-5:-(df.left-1)}function z(a){return a?-20:-1}function A(){return y(!rg)}function B(){return z(!rg)}function C(){return y(rg)}function D(){return z(rg)}function E(a){return a?gf+2+4:df.left+20}function F(a){return a?80:jf+2}function G(){return E(!rg)}function H(){return F(!rg)}function I(){return E(rg)}function J(){return F(rg)}function K(){var a=rg?jf:gf,b=tc(),c=Vb()*(Dd(Se.data.targets)?(b-(Gh?.25:1))/b:.98);return b>1?a*c/(b-1):a}function L(a){Vh=a}function M(a){Wh=a}function N(a){Xh=a}function O(){return ng?Uh?Wh*(Vh+1):lf
|
|
|
|
"circle"===this.nodeName&&a.attr("r",ch),ei.select("."+f.eventRect+"-"+b).style("cursor",null)}).filter(function(){return"circle"===this.nodeName?Ud(this,dh):"path"===this.nodeName?Vd(this):void 0}).each(function(){var a=Re.select(this);a.classed(f.EXPANDED)||(a.classed(f.EXPANDED,!0),"circle"===this.nodeName&&a.attr("r",dh)),ei.select("."+f.eventRect+"-"+b).style("cursor","pointer")})))}).on("click",function(a,b){return Hd(Se.data.targets)?void 0:Kh?void(Kh=!1):void gi.selectAll("."+f.shape+"-"+b).each(function(a){ve(this,a,b)})}).call(Re.behavior.drag().origin(Object).on("drag",function(){we(Re.mouse(this))}).on("dragstart",function(){xe(Re.mouse(this))}).on("dragend",function(){ye()})).call(di).on("dblclick.zoom",null)}function ue(a){a.append("rect").attr("x",0).attr("y",0).attr("width",gf).attr("height",jf).attr("class",f.eventRect).on("mouseout",function(){Hd(Se.data.targets)||(td(),rd(),ie())}).on("mousemove",function(){var a,b,c;Jh||Hd(Se.data.targets)||(a=Re.mouse(this),b=kd(Se.data.targets,a),c=[jc(b)],qd(c,a),bh&&(ie(),he(b.index,b.id)),sd(c),Zd(b,a)<100?(ei.select("."+f.eventRect).style("cursor","pointer"),Lh||(eg(b),Lh=!0)):(ei.select("."+f.eventRect).style("cursor",null),fg(b),Lh=!1))}).on("click",function(){var a,b;Hd(Se.data.targets)||(a=Re.mouse(this),b=kd(Se.data.targets,a),Zd(b,a)<100&&gi.select("."+f.circles+"-"+Vc(b.id)).select("."+f.circle+"-"+b.index).each(function(){ve(this,b,b.index)}))}).call(Re.behavior.drag().origin(Object).on("drag",function(){we(Re.mouse(this))}).on("dragstart",function(){xe(Re.mouse(this))}).on("dragend",function(){ye()})).call(di).on("dblclick.zoom",null)}function ve(a,b,c){var d,e=Re.select(a),g=e.classed(f.SELECTED),h=!1;"circle"===a.nodeName?(h=Ud(a,1.5*dh),d=be):"path"===a.nodeName&&(h=Vd(a),d=ee),(ag||h)&&(_f&&bg(b)&&(cg||gi.selectAll("."+f.shapes+(ag?Vc(b.id):"")).selectAll("."+f.shape).each(function(a,b){var c=Re.select(this);c.classed(f.SELECTED)&&d(!1,c.classed(f.SELECTED,!1),a,b)}),e.classed(f.SELECTED,!g),d(!g,e,b,c)),dg(b,a))}function we(a){var b,c,d,e,g,h,i,j;Hd(Se.data.targets)||_f&&(!Ze||di.altDomain)&&cg&&(b=Ih[0],c=Ih[1],d=a[0],e=a[1],g=Math.min(b,d),h=Math.max(b,d),i=ag?df.top:Math.min(c,e),j=ag?jf:Math.max(c,e),gi.select("."+f.dragarea).attr("x",g).attr("y",i).attr("width",h-g).attr("height",j-i),gi.selectAll("."+f.shapes).selectAll("."+f.shape).filter(function(a){return bg(a)}).each(function(a,b){var c,d,e,k,l,m,n=Re.select(this),o=n.classed(f.SELECTED),p=n.classed(f.INCLUDED),q=!1;"circle"===this.nodeName?(c=1*n.attr("cx"),d=1*n.attr("cy"),l=be,q=c>g&&h>c&&d>i&&j>d):"path"===this.nodeName&&(m=md(this),c=m.x,d=m.y,e=m.width,k=m.height,l=ee,q=!(c>h||g>c+e||d>j||i>d+k)),q^p&&(n.classed(f.INCLUDED,!p),n.classed(f.SELECTED,!o),l(!o,n,a,b))}))}function xe(a){Hd(Se.data.targets)||_f&&(Ih=a,gi.select("."+f.chart).append("rect").attr("class",f.dragarea).style("opacity",.1),Jh=!0,ig())}function ye(){Hd(Se.data.targets)||_f&&(gi.select("."+f.dragarea).transition().duration(100).style("opacity",0).remove(),gi.selectAll("."+f.shape).classed(f.INCLUDED,!1),Jh=!1,jg())}function ze(a){var c,e,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u,v,w,x,y,z,A,B,C,D,E,F,G,H,I=wd(),J=Hd(Se.data.targets),L=zc(Se.data.targets);if(0!==L.length){if(a=d(a)?a:{},u=d(a.withY)?a.withY:!0,v=d(a.withSubchart)?a.withSubchart:!0,w=d(a.withTransition)?a.withTransition:!0,x=d(a.withTransform)?a.withTransform:!1,y=d(a.withUpdateXDomain)?a.withUpdateXDomain:!1,z=d(a.withUpdateOrgXDomain)?a.withUpdateOrgXDomain:!1,A=d(a.withLegend)?a.withLegend:!1,F=w?cf:0,G=d(a.durationForExit)?a.durationForExit:F,H=d(a.durationForAxis)?a.durationForAxis:F,A&&ng&&Ne(Se.data.targets,a),z&&(Ef.domain(Re.extent(Zb(L))),li=Ef.domain(),Ze&&di.scale(Ef).updateScaleExtent(),Hf.domain(Ef.domain()),_h.scale(Hf)),y&&(Ef.domain(_h.empty()?li:_h.extent()),Ze&&di.scale(Ef).updateScaleExtent()),Ff.domain(Ub(L,"y")),Gf.domain(Ub(L,"y2")),gi.select("."+f.axisX).style("opacity",J?0:1).transition().duration(H).call(Kf),gi.select("."+f.axisY).style("opacity",J?0:1).transition().duration(H).call(Lf),gi.select("."+f.axisY2).style("opacity",J?0:1).t
|