From 17478d6d3137b991e3317b0947b43e06f7472a77 Mon Sep 17 00:00:00 2001 From: Masayuki Tanaka Date: Wed, 2 Apr 2014 11:20:22 +0900 Subject: [PATCH] Update version to 0.1.26 --- bower.json | 2 +- c3.js | 6 +++--- c3.min.js | 2 +- package.json | 2 +- 4 files changed, 6 insertions(+), 6 deletions(-) diff --git a/bower.json b/bower.json index 7559550..63562b2 100644 --- a/bower.json +++ b/bower.json @@ -1,7 +1,7 @@ { "name": "c3", "main": "c3.min.js", - "version": "0.1.25", + "version": "0.1.26", "homepage": "https://github.com/masayuki0812/c3", "authors": [ "Masayuki Tanaka " diff --git a/c3.js b/c3.js index 6e6ca1f..f61b598 100644 --- a/c3.js +++ b/c3.js @@ -1,7 +1,9 @@ (function (window) { 'use strict'; - var c3 = {}; + var c3 = { + version: "0.1.26" + }; var CLASS = { target: 'c3-target', @@ -62,8 +64,6 @@ INCLUDED: '_included_', }; - c3.version = "0.1.24"; - /* * Generate chart according to config */ diff --git a/c3.min.js b/c3.min.js index efef4d5..763479c 100644 --- a/c3.min.js +++ b/c3.min.js @@ -1,2 +1,2 @@ -!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={},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.version="0.1.24",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;cff&&(ff=0),0>hf&&(hf=0),df={top:qg?cf.top:lf-kg-(Th?0:mf),right:0/0,bottom:20+(Th?0:mf),left:qg?Xh:cf.left},gf=qg?cf.left-Xh-Yh:ff,jf=qg?hf:lf-df.top-df.bottom,0>gf&&(gf=0),0>jf&&(jf=0),ef={top:Th?0:lf-mf,right:0/0,bottom:0,left:Th?kf-nf:0},o(),Th&&Gd(Re.data.targets)&&(ef.left=ff/2+pf)}function o(){pf=hf/2,of=.95*pf,qf=Fd(Re.data.targets)?.6*of:0}function p(){var a=qg?f.axisX:f.axisY,b=Qe.select("."+a).node(),c=b?b.getBoundingClientRect():{right:0},d=Qe.select(Te).node().getBoundingClientRect(),e=c.right-d.left-s();return e>0?e:0}function q(){return Ue?Ue:w()}function r(){var a=Ve?Ve:x();return a>0?a:320}function s(){return Gd(Re.data.targets)?0:We?We:qg||!Bg||Gg?1:u("y")}function t(){var a=1;return Gd(Re.data.targets)?0:Xe?Xe:Th?nf+(Kg&&!qg?u("y2"):a):Kg?Pg||qg?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||Bg?"y2"!==a||Kg?(gb(a).isInner?30:40)+("y2"===a?-10:0):Zh:mg&&!Th?10:1}function w(){return+Qe.select(Te).style("width").replace("px","")}function x(){return+Qe.select(Te).style("height").replace("px","")}function y(a){return a?-5:-(cf.left-1)}function z(a){return a?-20:-1}function A(){return y(!qg)}function B(){return z(!qg)}function C(){return y(qg)}function D(){return z(qg)}function E(a){return a?ff+2+4:cf.left+20}function F(a){return a?80:hf+2}function G(){return E(!qg)}function H(){return F(!qg)}function I(){return E(qg)}function J(){return F(qg)}function K(){var a=qg?hf:ff,b=sc(),c=Ub()*(Cd(Re.data.targets)?(b-(Fh?.25:1))/b:.98);return b>1?a*c/(b-1):a}function L(a){Uh=a}function M(a){Vh=a}function N(a){Wh=a}function O(){return mg?Th?Vh*(Uh+1):kf:0}function P(){return mg?Th?lf:Wh*(Uh+1):0}function Q(){var a,b,c=!Df;vf=qg?1:0,wf=qg?hf:ff,xf=qg?0:hf,yf=qg?ff:1,zf=vf,Af=wf,Bf=qg?0:jf,Cf=qg?gf:1,Df=S(vf,wf,c?void 0:Df.domain(),function(){return Jf.tickOffset()}),Ef=T(xf,yf),Ff=T(xf,yf),Gf=S(vf,wf,ki,function(a){return a%1?0:Mf.tickOffset()}),Hf=T(Bf,Cf),If=T(Bf,Cf),a=Z(),b=$(),Jf=W(Df,Oh,a,b),Mf=W(Gf,Rh,a,b),Kf=X(Ef,Ph,Hg,Jg),Lf=X(Ff,Qh,Qg,Sg),c||($h.scale(Gf),Ye&&ci.scale(Df)),R()}function R(){rf=Cb(),sf=Db(),tf=Db(.98)}function S(a,b,e,f){var g=(Eh?Qe.time.scale():Qe.scale.linear()).range([a,b]);if(g.orgDomain=function(){return g.domain()},d(e)&&g.domain(e),c(f)&&(f=function(){return 0}),Fh){var h,i=g;g=function(a){return i(a)+f(a)};for(h in i)g[h]=i[h];g.orgDomain=function(){return i.domain()},g.domain=function(a){return arguments.length?(i.domain(a),g):(a=i.domain(),[a[0],a[1]+1])}}return g}function T(a,b){return Qe.scale.linear().range([a,b])}function U(a){return"y2"===Y(a)?Ff:Ef}function V(a){return"y2"===Y(a)?If:Hf}function W(a,b,c,d){var e=(Fh?Ab():Qe.svg.axis()).scale(a).orient(b);return e.tickFormat(c).ticks(d),Fh?e.tickCentered(tg):e.tickOffset=function(){var a=qg?hf:ff;return a*Ub()/sc()/2},Fh&&e.categories(sg),e}function X(a,b,c,d){return Qe.svg.axis().scale(a).orient(b).tickFormat(c).ticks(d).outerTickSize(0)}function Y(a){return a in Tf?Tf[a]:"y"}function Z(){var a=Eh?Mh:Fh?Fc:null;return ug&&("function"==typeof ug?a=ug:Eh&&(a=function(a){return Qe.time.format(ug)(a)})),a}function $(){var a=sc();return vg&&a>wg?wg:a}function _(a){var b;return"y"===a?b=Fg:"y2"===a?b=Og:"x"===a&&(b=Ag),b}function ab(a){var b=_(a);return"string"==typeof b?b:b?b.text:null}function bb(a,b){var c=_(a);"string"==typeof c?"y"===a?Fg=b:"y2"===a?Og=b:"x"===a&&(Ag=b):c&&(c.text=b)}function cb(a,b){var c=_(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}}function db(){return cb("x",qg?"inner-top":"inner-right")}function eb(){return cb("y",qg?"inner-right":"inner-top")}function fb(){return cb("y2",qg?"inner-right":"inner-top")}function gb(a){return"y2"===a?fb():"y"===a?eb():db()}function hb(){return ab("x")}function ib(){return ab("y")}function jb(){return ab("y2")}function kb(a,b){return a?b.isLeft?0:b.isCenter?ff/2:ff:b.isBottom?-hf:b.isMiddle?-hf/2:0}function lb(a,b){return a?b.isLeft?"0.5em":b.isRight?"-0.5em":"0":b.isTop?"-0.5em":b.isBottom?"0.5em":"0"}function mb(a,b){return a?b.isLeft?"start":b.isCenter?"middle":"end":b.isBottom?"start":b.isMiddle?"middle":"end"}function nb(){return kb(!qg,db())}function ob(){return kb(qg,eb())}function pb(){return kb(qg,fb())}function qb(){return lb(!qg,db())}function rb(){return lb(qg,eb())}function sb(){return lb(qg,fb())}function tb(){var a=db();return qg?a.isInner?"1.2em":-30-zb("x"):a.isInner?"-0.5em":"3em"}function ub(){var a=eb();return qg?a.isInner?"-0.5em":"3em":a.isInner?"1.2em":-20-zb("y")}function vb(){var a=fb();return qg?a.isInner?"1.2em":"-2.2em":a.isInner?"-0.5em":30+zb("y2")}function wb(){return mb(!qg,db())}function xb(){return mb(qg,eb())}function yb(){return mb(qg,fb())}function zb(a){var b=0,c="x"===a?f.axisX:"y"===a?f.axisY:f.axisY2;return Qe.selectAll("."+c+" .tick text").each(function(){var a=this.getBBox();bb?20:b}function Ab(){function a(a,b){a.attr("transform",function(a){return"translate("+(b(a)+p)+", 0)"})}function b(a,b){a.attr("transform",function(a){return"translate(0,"+b(a)+")"})}function c(a){var b=a[0],c=a[a.length-1];return c>b?[b,c]:[c,b]}function d(a){for(var b=[],c=Math.ceil(a[0]);c0&&b[0]>0&&b.unshift(b[0]-(b[1]-b[0])),b}function e(a,b){var c=a.length-1;return o>=c||b%Math.ceil(c/o)===0}function f(a){return a0)for(g=Dc(a),b=0;b=0}),0!==e.length)for(d=e[0],g&&i[d]&&i[d].forEach(function(a,b){i[d][b]=0>a?a:0}),c=1;c0||(i[d][b]+=+a)});return Qe.min(Object.keys(i).map(function(a){return Qe.min(i[a])}))}function Sb(a){var b,c,d,e,f,g,h=uc(a),i=Bc(a);if(Sf.length>0)for(g=Ec(a),b=0;b=0}),0!==e.length)for(d=e[0],g&&i[d]&&i[d].forEach(function(a,b){i[d][b]=a>0?a:0}),c=1;c+a||(i[d][b]+=+a)});return Qe.max(Object.keys(i).map(function(a){return Qe.max(i[a])}))}function Tb(a,c){var d,e,f,g,h,i,j,k,l=a.filter(function(a){return Y(a.id)===c}),m="y2"===c?Mg:Dg,n="y2"===c?Lg:Cg,o=b(m)?m:Rb(l),p=b(n)?n:Sb(l),q="y2"===c?Ng:Eg,r=$c()&&qg;return 0===l.length?"y2"===c?Ff.domain():Ef.domain():(o===p&&(0>o?p=0:o=0),d=Math.abs(p-o),e=f=g=r?0:.1*d,q&&(h=Math.max(Math.abs(o),Math.abs(p)),p=h-q,o=q-h),"y"===c&&Ig&&(f=b(Ig.top)?Ig.top:e,g=b(Ig.bottom)?Ig.bottom:e),"y2"===c&&Rg&&(f=b(Rg.top)?Rg.top:e,g=b(Rg.bottom)?Rg.bottom:e),r&&(i=_c(o,p),j=Zb(Ef.range()),k=[i[0]/j,i[1]/j],f+=d*(k[1]/(1-k[0]-k[1])),g+=d*(k[0]/(1-k[0]-k[1]))),Cd(l)&&!Dc(l)&&(g=o),[o-g,p+f])}function Ub(a){var b=Zb(ki),c=Zb(Df.domain());return a||0===c?1:b/c}function Vb(a){return yg?yg:Qe.min(a,function(a){return Qe.min(a.values,function(a){return a.x})})}function Wb(a){return xg?xg:Qe.max(a,function(a){return Qe.max(a.values,function(a){return a.x})})}function Xb(a,b){var c,d,e=b[0],f=b[1],g=Math.abs(e-f);return Fh?d=0:Cd(a)?(c=sc(),d=c>1?g/(c-1)/2:.5):d=.01*g,d}function Yb(a){var b=[Vb(a),Wb(a)],c=b[0],d=b[1],e=Xb(a,b),f=Eh?new Date(c.getTime()-e):c-e,g=Eh?new Date(d.getTime()+e):d+e;return[f,g]}function Zb(a){return a[1]-a[0]}function $b(a){for(var b=0;bd?0:d}function dc(a){return Nf&&a===Nf||Wd(Of)&&Xd(Of,a)}function ec(a){return!dc(a)}function fc(a){return Nf?Nf:Wd(Of)?Of[a]:null}function gc(a,b){return a in Re.data.x&&Re.data.x[a]&&Re.data.x[a][b]?Re.data.x[a][b]:b}function hc(a){Object.keys(a).forEach(function(b){Of[b]=a[b]})}function ic(a){var b;return a&&(b=Rf[a.id],a.name=b?b:a.id),a}function jc(a,b){a.forEach(function(a){a.values.forEach(function(c,d){c.x=lc(b[d],a.id,d)}),Re.data.x[a.id]=b})}function kc(a,b){a.forEach(function(a){b[a.id]&&jc([a],b[a.id])})}function lc(a,b,c){var d;return d=Eh?a?a instanceof Date?a:Sd(a):Sd(gc(b,c)):Gh&&!Fh?a?+a:gc(b,c):c}function mc(a){var b,c,d=a[0],e={},f=[];for(b=1;b=0&&(Re.data.x[b]=a.map(function(a){return a[c]})):Re.data.x[b]=a.map(function(a,b){return b})}),c.forEach(function(a){if(!Re.data.x[a])throw new Error('x is not defined for id = "'+a+'".')}),b=c.map(function(b,c){var d=Qf(b);return{id:d,id_org:b,values:a.map(function(a,e){var f=fc(b),g=a[f],h=lc(g,b,e);return Gh&&Fh&&0===c&&g&&(0===e&&(sg=[]),sg.push(g)),"undefined"==typeof a[b]&&(h=void 0),{x:h,value:null===a[b]||isNaN(a[b])?null:+a[b],id:d}}).filter(function(a){return"undefined"!=typeof a.x})}}),b.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++})}),Uf&&Ad(uc(b).filter(function(a){return!(a in Vf)}),Uf),b.forEach(function(a){_b(a.id_org,a)}),b}function pc(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}})}}function qc(a){return a>0&&Re.data.targets[0].values[a-1]?Re.data.targets[0].values[a-1].x:void 0}function rc(a){return a1?Re.data.targets.forEach(function(b){b.values.length>c&&(a=b,c=b.values.length)}):a=b?Re.data.targets[0]:null,a}function uc(a){return a=c(a)?Re.data.targets:a,a.map(function(a){return a.id})}function vc(a){var b,c=uc();for(b=0;ba})}function Ec(a){return Cc(a,function(a){return a>0})}function Fc(a){return a=0&&d===a[c].x;c--)e.push(a[c]);for(c=b;c0?g=h:f=h,g-f===1||0===f&&0===g?(e=[],a[f].x&&(e=e.concat(hd(a,f))),a[g].x&&(e=e.concat(hd(a,g))),kd(e,b)):id(a,b,f,g)}function jd(a,b){var c;return c=a.map(function(a){return id(a.values,b)}),kd(c,b)}function kd(a,b){var c,d;return a.forEach(function(a){var e=Yd(a,b);(c>e||!c)&&(c=e,d=a)}),d}function ld(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}}function md(){return Xf&&"desc"===Xf.toLowerCase()}function nd(){return Xf&&"asc"===Xf.toLowerCase()}function od(a){var b=nd(),c=md();return b||c?a.sort(function(a,c){var d=function(a,b){return a+Math.abs(b.value)},e=a.values.reduce(d,0),f=c.values.reduce(d,0);return b?f-e:e-f}):"function"==typeof Xf&&a.sort(Xf),a}function pd(a,c){var d,e,f,g,h,i,j,k=Gd(Re.data.targets),l=k?bd:ad,m=a.filter(function(a){return a&&b(a.value)});rh&&0!==m.length&&(ii.html(uh(a,Z(),l,Lh)).style("display","block"),d=ii.property("offsetWidth"),e=ii.property("offsetHeight"),k?(g=ff/2+c[0],i=hf/2+c[1]+20):(qg?(f=p(),g=f+c[0]+100,h=g+d,j=q()-t(),i=Df(m[0].x)+20):(f=p(),g=f+s()+Df(m[0].x)+20,h=g+d,j=f+q()-t(),i=c[1]+15),h>j&&(g-=d+60),i+e>r()&&(i-=e+30)),ii.style("top",i+"px").style("left",g+"px"))}function qd(){ii.style("display","none")}function rd(a){var c=a.filter(function(a){return a&&b(a.value)});rh&&(Dd(Re.data.targets)||Gd(Re.data.targets)||fi.selectAll("line."+f.xgridFocus).style("visibility","visible").data([c[0]]).attr(qg?"y1":"x1",dd).attr(qg?"y2":"x2",dd))}function sd(){fi.select("line."+f.xgridFocus).style("visibility","hidden")}function td(a){return a.x||0===a.x?Df(a.x):null}function ud(a){return U(a.id)(a.value)}function vd(){var a,b,d={},e=0;return yc(wc(Jd)).forEach(function(f){for(a=0;a0&&(i+=g(b.values[f].value)-h)}),i}}function zd(a,b){return dh?dh:b?2*a.tickOffset()*eh/b:0}function Ad(a,b){var d=c(a)?uc():a;"string"==typeof d&&(d=[d]);for(var e=0;e0}function Xd(a,b){var c=!1;return Object.keys(a).forEach(function(d){a[d]===b&&(c=!0)}),c}function Yd(a,b){return Math.pow(Df(a.x)-b[0],2)+Math.pow(Ef(a.value)-b[1],2)}function Zd(a,b){var c=0;a.each(function(){++c}).each("end",function(){--c||b.apply(this,arguments)})}function $d(a,b,c){fg(b,a.node()),fi.select("."+f.selectedCircles+Uc(b.id)).selectAll("."+f.selectedCircle+"-"+c).data([b]).enter().append("circle").attr("class",function(){return Gc(f.selectedCircle,c)}).attr("cx",qg?ud:td).attr("cy",qg?td:ud).attr("stroke",function(){return Lh(b.id)}).attr("r",1.4*ch).transition().duration(100).attr("r",ch)}function _d(a,b,c){gg(b,a.node()),fi.select("."+f.selectedCircles+Uc(b.id)).selectAll("."+f.selectedCircle+"-"+c).transition().duration(100).attr("r",0).remove()}function ae(a,b,c,d){a?$d(b,c,d):_d(b,c,d)}function be(a,b){fg(b,a.node()),a.transition().duration(100).style("fill",function(){return Qe.rgb(Lh(b.id)).darker(1)})}function ce(a,b){gg(b,a.node()),a.transition().duration(100).style("fill",function(){return Lh(b.id)})}function de(a,b,c,d){a?be(b,c,d):ce(b,c,d)}function ee(a){return a.filter(function(a){return b(a.value)})}function fe(a,c){return(c?fi.selectAll("."+f.circles+Uc(c)):fi).selectAll("."+f.circle+(b(a)?"-"+a:""))}function ge(a,b){fe(a,b).classed(f.EXPANDED,!0).attr("r",bh)}function he(a){fe(a).filter(function(){return Qe.select(this).classed(f.EXPANDED)}).classed(f.EXPANDED,!1).attr("r",$g)}function ie(a){return fi.selectAll("."+f.bar+(b(a)?"-"+a:""))}function je(a){ie(a).classed(f.EXPANDED,!0)}function ke(a){ie(a).classed(f.EXPANDED,!1)}function le(a,b){var c=pe(a,b);return function(a,b){var d=c(a,b),e=qg?1:0,f=qg?0:1,g="M "+d[0][e]+","+d[0][f]+" L"+d[1][e]+","+d[1][f]+" L"+d[2][e]+","+d[2][f]+" L"+d[3][e]+","+d[3][f]+" z";return g}}function me(a,b){var c=pe(a,!1),d=b?ne:oe;return function(a,b){return d(c(a,b),a,this)}}function ne(a,b){var c;return qg?(c=Jd(b)?4:6,a[2][1]+c*(b.value<0?-1:1)):a[0][0]+(a[2][0]-a[0][0])/2}function oe(a,b,c){var d=c.getBBox();return qg?(a[0][0]+a[2][0]+.6*d.height)/2:a[2][1]+(b.value<0?d.height:Jd(b)?-3:-6)}function pe(a,b){var c=a.__max__+1,d=zd(Jf,c),e=wd(d,c,a,!!b),f=xd(!!b),g=yd(a,!!b),h=b?V:U;return function(a,b){var c=h(a.id)(0),i=g(a,b)||c,j=e(a),k=f(a);return qg&&(a.value>0&&i>k||a.value<0&&k>i)&&(k=i),[[j,i],[j,k-(c-i)],[j+d,k-(c-i)],[j+d,i]]}}function qe(a,b,e,f){var g,h,i,j,k,l,m,n,o,p,q,r=-1,s="M",t=[];if(d(f))for(g=0;g=h;h+=u)s+=i(a[g-1],a[g],h,o)}r=a[g].x}return s}function re(b){var c,d,e;if(ji=Qe.select(Te),ji.empty())throw new Error('No bind element found. Check the selector specified by "bindto" and existance of that element. Default "bindto" is "#chart".');if(ji.html(""),ji.classed("c3",!0),Re.data.x={},Re.data.targets=oc(b),n(),Q(),Df.domain(Qe.extent(Yb(Re.data.targets))),Ef.domain(Tb(Re.data.targets,"y")),Ff.domain(Tb(Re.data.targets,"y2")),Gf.domain(Df.domain()),Hf.domain(Ef.domain()),If.domain(Ff.domain()),ki=Df.domain(),$h.scale(Gf),Ye&&ci.scale(Df),di=ji.append("svg").attr("width",ff+cf.left+cf.right).attr("height",hf+cf.top+cf.bottom).on("mouseenter",_e).on("mouseleave",af),ei=di.append("defs"),ei.append("clipPath").attr("id",yh).append("rect").attr("width",ff).attr("height",hf),ei.append("clipPath").attr("id",zh).append("rect").attr("x",A).attr("y",B).attr("width",G).attr("height",H),ei.append("clipPath").attr("id",Ah).append("rect").attr("x",C).attr("y",D).attr("width",I).attr("height",J),fi=di.append("g").attr("transform",Sh.main),gi=jg?di.append("g").attr("transform",Sh.context):null,hi=mg?di.append("g").attr("transform",Sh.legend):null,ii=Qe.select(Te).style("position","relative").append("div").style("position","absolute").style("pointer-events","none").style("z-index","10").style("display","none"),fi.append("g").attr("class",f.axisX).attr("clip-path",qg?"":Ch).attr("transform",Sh.x).append("text").attr("class",f.axisXLabel).attr("transform",qg?"rotate(-90)":"").attr("dx",qb).attr("dy",tb).style("text-anchor",wb),Bg&&fi.append("g").attr("class",f.axisY).attr("clip-path",qg?Dh:"").append("text").attr("class",f.axisYLabel).attr("transform",qg?"":"rotate(-90)").attr("dx",rb).attr("dy",ub).style("text-anchor",xb),Kg&&fi.append("g").attr("class",f.axisY2).attr("transform",Sh.y2).append("text").attr("class",f.axisY2Label).attr("transform",qg?"":"rotate(-90)").attr("dx",sb).style("text-anchor",yb),d=fi.append("g").attr("clip-path",Bh).attr("class",f.grid),Tg&&d.append("g").attr("class",f.xgrids),Wd(Vg)&&d.append("g").attr("class",f.xgridLines),_g&&d.append("g").attr("class",f.xgridFocus).append("line").attr("class",f.xgridFocus).attr("x1",qg?0:-10).attr("x2",qg?ff:-10).attr("y1",qg?-10:cf.top).attr("y2",qg?-10:hf),Wg&&d.append("g").attr("class",f.ygrids),Wd(Xg)&&d.append("g").attr("class",f.ygridLines),fi.append("g").attr("clip-path",Bh).attr("class",f.regions),fi.append("g").attr("clip-path",Bh).attr("class",f.chart),c=fi.select("."+f.chart).append("g").attr("class",f.eventRects).style("fill-opacity",0).style("cursor",Ye?qg?"ns-resize":"ew-resize":null),fi.select("."+f.chart).append("g").attr("class",f.chartBars),fi.select("."+f.chart).append("g").attr("class",f.chartLines),fi.select("."+f.chart).append("g").attr("class",f.chartArcs).attr("transform",Sh.arc).append("text").attr("class",f.chartArcsTitle).style("text-anchor","middle").text(Nb()),fi.select("."+f.chart).append("g").attr("class",f.chartTexts),Ye&&fi.insert("rect",$e?null:"g."+f.grid).attr("class",f.zoomRect).attr("width",ff).attr("height",hf).style("opacity",0).style("cursor",qg?"ns-resize":"ew-resize").call(ci).on("dblclick.zoom",null),zg&&$h.extent("function"!=typeof zg?zg:zg(Yb())),jg&&(gi.append("g").attr("clip-path",Bh).attr("class",f.chart),gi.select("."+f.chart).append("g").attr("class",f.chartBars),gi.select("."+f.chart).append("g").attr("class",f.chartLines),gi.append("g").attr("clip-path",Bh).attr("class",f.brush).call($h).selectAll("rect").attr(qg?"width":"height",qg?gf:jf),gi.append("g").attr("class",f.axisX).attr("transform",Sh.subx).attr("clip-path",qg?"":Ch)),Ee(Re.data.targets),qg?fi.select("."+f.axisX).style("opacity",0).call(Jf):(fi.select("."+f.axisY).style("opacity",0).call(Kf),fi.select("."+f.axisY2).style("opacity",0).call(Lf)),De({withTransform:!0,withLegend:!0,durationForAxis:0}),vh){if(Eh&&"string"==typeof wh){for(wh=Sd(wh),e=0;e0){d=[];for(var g in Rf)for(c=0;cff&&(ff=0),0>hf&&(hf=0),df={top:qg?cf.top:lf-kg-(Th?0:mf),right:0/0,bottom:20+(Th?0:mf),left:qg?Xh:cf.left},gf=qg?cf.left-Xh-Yh:ff,jf=qg?hf:lf-df.top-df.bottom,0>gf&&(gf=0),0>jf&&(jf=0),ef={top:Th?0:lf-mf,right:0/0,bottom:0,left:Th?kf-nf:0},o(),Th&&Gd(Re.data.targets)&&(ef.left=ff/2+pf)}function o(){pf=hf/2,of=.95*pf,qf=Fd(Re.data.targets)?.6*of:0}function p(){var a=qg?f.axisX:f.axisY,b=Qe.select("."+a).node(),c=b?b.getBoundingClientRect():{right:0},d=Qe.select(Te).node().getBoundingClientRect(),e=c.right-d.left-s();return e>0?e:0}function q(){return Ue?Ue:w()}function r(){var a=Ve?Ve:x();return a>0?a:320}function s(){return Gd(Re.data.targets)?0:We?We:qg||!Bg||Gg?1:u("y")}function t(){var a=1;return Gd(Re.data.targets)?0:Xe?Xe:Th?nf+(Kg&&!qg?u("y2"):a):Kg?Pg||qg?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||Bg?"y2"!==a||Kg?(gb(a).isInner?30:40)+("y2"===a?-10:0):Zh:mg&&!Th?10:1}function w(){return+Qe.select(Te).style("width").replace("px","")}function x(){return+Qe.select(Te).style("height").replace("px","")}function y(a){return a?-5:-(cf.left-1)}function z(a){return a?-20:-1}function A(){return y(!qg)}function B(){return z(!qg)}function C(){return y(qg)}function D(){return z(qg)}function E(a){return a?ff+2+4:cf.left+20}function F(a){return a?80:hf+2}function G(){return E(!qg)}function H(){return F(!qg)}function I(){return E(qg)}function J(){return F(qg)}function K(){var a=qg?hf:ff,b=sc(),c=Ub()*(Cd(Re.data.targets)?(b-(Fh?.25:1))/b:.98);return b>1?a*c/(b-1):a}function L(a){Uh=a}function M(a){Vh=a}function N(a){Wh=a}function O(){return mg?Th?Vh*(Uh+1):kf:0}function P(){return mg?Th?lf:Wh*(Uh+1):0}function Q(){var a,b,c=!Df;vf=qg?1:0,wf=qg?hf:ff,xf=qg?0:hf,yf=qg?ff:1,zf=vf,Af=wf,Bf=qg?0:jf,Cf=qg?gf:1,Df=S(vf,wf,c?void 0:Df.domain(),function(){return Jf.tickOffset()}),Ef=T(xf,yf),Ff=T(xf,yf),Gf=S(vf,wf,ki,function(a){return a%1?0:Mf.tickOffset()}),Hf=T(Bf,Cf),If=T(Bf,Cf),a=Z(),b=$(),Jf=W(Df,Oh,a,b),Mf=W(Gf,Rh,a,b),Kf=X(Ef,Ph,Hg,Jg),Lf=X(Ff,Qh,Qg,Sg),c||($h.scale(Gf),Ye&&ci.scale(Df)),R()}function R(){rf=Cb(),sf=Db(),tf=Db(.98)}function S(a,b,e,f){var g=(Eh?Qe.time.scale():Qe.scale.linear()).range([a,b]);if(g.orgDomain=function(){return g.domain()},d(e)&&g.domain(e),c(f)&&(f=function(){return 0}),Fh){var h,i=g;g=function(a){return i(a)+f(a)};for(h in i)g[h]=i[h];g.orgDomain=function(){return i.domain()},g.domain=function(a){return arguments.length?(i.domain(a),g):(a=i.domain(),[a[0],a[1]+1])}}return g}function T(a,b){return Qe.scale.linear().range([a,b])}function U(a){return"y2"===Y(a)?Ff:Ef}function V(a){return"y2"===Y(a)?If:Hf}function W(a,b,c,d){var e=(Fh?Ab():Qe.svg.axis()).scale(a).orient(b);return e.tickFormat(c).ticks(d),Fh?e.tickCentered(tg):e.tickOffset=function(){var a=qg?hf:ff;return a*Ub()/sc()/2},Fh&&e.categories(sg),e}function X(a,b,c,d){return Qe.svg.axis().scale(a).orient(b).tickFormat(c).ticks(d).outerTickSize(0)}function Y(a){return a in Tf?Tf[a]:"y"}function Z(){var a=Eh?Mh:Fh?Fc:null;return ug&&("function"==typeof ug?a=ug:Eh&&(a=function(a){return Qe.time.format(ug)(a)})),a}function $(){var a=sc();return vg&&a>wg?wg:a}function _(a){var b;return"y"===a?b=Fg:"y2"===a?b=Og:"x"===a&&(b=Ag),b}function ab(a){var b=_(a);return"string"==typeof b?b:b?b.text:null}function bb(a,b){var c=_(a);"string"==typeof c?"y"===a?Fg=b:"y2"===a?Og=b:"x"===a&&(Ag=b):c&&(c.text=b)}function cb(a,b){var c=_(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}}function db(){return cb("x",qg?"inner-top":"inner-right")}function eb(){return cb("y",qg?"inner-right":"inner-top")}function fb(){return cb("y2",qg?"inner-right":"inner-top")}function gb(a){return"y2"===a?fb():"y"===a?eb():db()}function hb(){return ab("x")}function ib(){return ab("y")}function jb(){return ab("y2")}function kb(a,b){return a?b.isLeft?0:b.isCenter?ff/2:ff:b.isBottom?-hf:b.isMiddle?-hf/2:0}function lb(a,b){return a?b.isLeft?"0.5em":b.isRight?"-0.5em":"0":b.isTop?"-0.5em":b.isBottom?"0.5em":"0"}function mb(a,b){return a?b.isLeft?"start":b.isCenter?"middle":"end":b.isBottom?"start":b.isMiddle?"middle":"end"}function nb(){return kb(!qg,db())}function ob(){return kb(qg,eb())}function pb(){return kb(qg,fb())}function qb(){return lb(!qg,db())}function rb(){return lb(qg,eb())}function sb(){return lb(qg,fb())}function tb(){var a=db();return qg?a.isInner?"1.2em":-30-zb("x"):a.isInner?"-0.5em":"3em"}function ub(){var a=eb();return qg?a.isInner?"-0.5em":"3em":a.isInner?"1.2em":-20-zb("y")}function vb(){var a=fb();return qg?a.isInner?"1.2em":"-2.2em":a.isInner?"-0.5em":30+zb("y2")}function wb(){return mb(!qg,db())}function xb(){return mb(qg,eb())}function yb(){return mb(qg,fb())}function zb(a){var b=0,c="x"===a?f.axisX:"y"===a?f.axisY:f.axisY2;return Qe.selectAll("."+c+" .tick text").each(function(){var a=this.getBBox();bb?20:b}function Ab(){function a(a,b){a.attr("transform",function(a){return"translate("+(b(a)+p)+", 0)"})}function b(a,b){a.attr("transform",function(a){return"translate(0,"+b(a)+")"})}function c(a){var b=a[0],c=a[a.length-1];return c>b?[b,c]:[c,b]}function d(a){for(var b=[],c=Math.ceil(a[0]);c0&&b[0]>0&&b.unshift(b[0]-(b[1]-b[0])),b}function e(a,b){var c=a.length-1;return o>=c||b%Math.ceil(c/o)===0}function f(a){return a0)for(g=Dc(a),b=0;b=0}),0!==e.length)for(d=e[0],g&&i[d]&&i[d].forEach(function(a,b){i[d][b]=0>a?a:0}),c=1;c0||(i[d][b]+=+a)});return Qe.min(Object.keys(i).map(function(a){return Qe.min(i[a])}))}function Sb(a){var b,c,d,e,f,g,h=uc(a),i=Bc(a);if(Sf.length>0)for(g=Ec(a),b=0;b=0}),0!==e.length)for(d=e[0],g&&i[d]&&i[d].forEach(function(a,b){i[d][b]=a>0?a:0}),c=1;c+a||(i[d][b]+=+a)});return Qe.max(Object.keys(i).map(function(a){return Qe.max(i[a])}))}function Tb(a,c){var d,e,f,g,h,i,j,k,l=a.filter(function(a){return Y(a.id)===c}),m="y2"===c?Mg:Dg,n="y2"===c?Lg:Cg,o=b(m)?m:Rb(l),p=b(n)?n:Sb(l),q="y2"===c?Ng:Eg,r=$c()&&qg;return 0===l.length?"y2"===c?Ff.domain():Ef.domain():(o===p&&(0>o?p=0:o=0),d=Math.abs(p-o),e=f=g=r?0:.1*d,q&&(h=Math.max(Math.abs(o),Math.abs(p)),p=h-q,o=q-h),"y"===c&&Ig&&(f=b(Ig.top)?Ig.top:e,g=b(Ig.bottom)?Ig.bottom:e),"y2"===c&&Rg&&(f=b(Rg.top)?Rg.top:e,g=b(Rg.bottom)?Rg.bottom:e),r&&(i=_c(o,p),j=Zb(Ef.range()),k=[i[0]/j,i[1]/j],f+=d*(k[1]/(1-k[0]-k[1])),g+=d*(k[0]/(1-k[0]-k[1]))),Cd(l)&&!Dc(l)&&(g=o),[o-g,p+f])}function Ub(a){var b=Zb(ki),c=Zb(Df.domain());return a||0===c?1:b/c}function Vb(a){return yg?yg:Qe.min(a,function(a){return Qe.min(a.values,function(a){return a.x})})}function Wb(a){return xg?xg:Qe.max(a,function(a){return Qe.max(a.values,function(a){return a.x})})}function Xb(a,b){var c,d,e=b[0],f=b[1],g=Math.abs(e-f);return Fh?d=0:Cd(a)?(c=sc(),d=c>1?g/(c-1)/2:.5):d=.01*g,d}function Yb(a){var b=[Vb(a),Wb(a)],c=b[0],d=b[1],e=Xb(a,b),f=Eh?new Date(c.getTime()-e):c-e,g=Eh?new Date(d.getTime()+e):d+e;return[f,g]}function Zb(a){return a[1]-a[0]}function $b(a){for(var b=0;bd?0:d}function dc(a){return Nf&&a===Nf||Wd(Of)&&Xd(Of,a)}function ec(a){return!dc(a)}function fc(a){return Nf?Nf:Wd(Of)?Of[a]:null}function gc(a,b){return a in Re.data.x&&Re.data.x[a]&&Re.data.x[a][b]?Re.data.x[a][b]:b}function hc(a){Object.keys(a).forEach(function(b){Of[b]=a[b]})}function ic(a){var b;return a&&(b=Rf[a.id],a.name=b?b:a.id),a}function jc(a,b){a.forEach(function(a){a.values.forEach(function(c,d){c.x=lc(b[d],a.id,d)}),Re.data.x[a.id]=b})}function kc(a,b){a.forEach(function(a){b[a.id]&&jc([a],b[a.id])})}function lc(a,b,c){var d;return d=Eh?a?a instanceof Date?a:Sd(a):Sd(gc(b,c)):Gh&&!Fh?a?+a:gc(b,c):c}function mc(a){var b,c,d=a[0],e={},f=[];for(b=1;b=0&&(Re.data.x[b]=a.map(function(a){return a[c]})):Re.data.x[b]=a.map(function(a,b){return b})}),c.forEach(function(a){if(!Re.data.x[a])throw new Error('x is not defined for id = "'+a+'".')}),b=c.map(function(b,c){var d=Qf(b);return{id:d,id_org:b,values:a.map(function(a,e){var f=fc(b),g=a[f],h=lc(g,b,e);return Gh&&Fh&&0===c&&g&&(0===e&&(sg=[]),sg.push(g)),"undefined"==typeof a[b]&&(h=void 0),{x:h,value:null===a[b]||isNaN(a[b])?null:+a[b],id:d}}).filter(function(a){return"undefined"!=typeof a.x})}}),b.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++})}),Uf&&Ad(uc(b).filter(function(a){return!(a in Vf)}),Uf),b.forEach(function(a){_b(a.id_org,a)}),b}function pc(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}})}}function qc(a){return a>0&&Re.data.targets[0].values[a-1]?Re.data.targets[0].values[a-1].x:void 0}function rc(a){return a1?Re.data.targets.forEach(function(b){b.values.length>c&&(a=b,c=b.values.length)}):a=b?Re.data.targets[0]:null,a}function uc(a){return a=c(a)?Re.data.targets:a,a.map(function(a){return a.id})}function vc(a){var b,c=uc();for(b=0;ba})}function Ec(a){return Cc(a,function(a){return a>0})}function Fc(a){return a=0&&d===a[c].x;c--)e.push(a[c]);for(c=b;c0?g=h:f=h,g-f===1||0===f&&0===g?(e=[],a[f].x&&(e=e.concat(hd(a,f))),a[g].x&&(e=e.concat(hd(a,g))),kd(e,b)):id(a,b,f,g)}function jd(a,b){var c;return c=a.map(function(a){return id(a.values,b)}),kd(c,b)}function kd(a,b){var c,d;return a.forEach(function(a){var e=Yd(a,b);(c>e||!c)&&(c=e,d=a)}),d}function ld(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}}function md(){return Xf&&"desc"===Xf.toLowerCase()}function nd(){return Xf&&"asc"===Xf.toLowerCase()}function od(a){var b=nd(),c=md();return b||c?a.sort(function(a,c){var d=function(a,b){return a+Math.abs(b.value)},e=a.values.reduce(d,0),f=c.values.reduce(d,0);return b?f-e:e-f}):"function"==typeof Xf&&a.sort(Xf),a}function pd(a,c){var d,e,f,g,h,i,j,k=Gd(Re.data.targets),l=k?bd:ad,m=a.filter(function(a){return a&&b(a.value)});rh&&0!==m.length&&(ii.html(uh(a,Z(),l,Lh)).style("display","block"),d=ii.property("offsetWidth"),e=ii.property("offsetHeight"),k?(g=ff/2+c[0],i=hf/2+c[1]+20):(qg?(f=p(),g=f+c[0]+100,h=g+d,j=q()-t(),i=Df(m[0].x)+20):(f=p(),g=f+s()+Df(m[0].x)+20,h=g+d,j=f+q()-t(),i=c[1]+15),h>j&&(g-=d+60),i+e>r()&&(i-=e+30)),ii.style("top",i+"px").style("left",g+"px"))}function qd(){ii.style("display","none")}function rd(a){var c=a.filter(function(a){return a&&b(a.value)});rh&&(Dd(Re.data.targets)||Gd(Re.data.targets)||fi.selectAll("line."+f.xgridFocus).style("visibility","visible").data([c[0]]).attr(qg?"y1":"x1",dd).attr(qg?"y2":"x2",dd))}function sd(){fi.select("line."+f.xgridFocus).style("visibility","hidden")}function td(a){return a.x||0===a.x?Df(a.x):null}function ud(a){return U(a.id)(a.value)}function vd(){var a,b,d={},e=0;return yc(wc(Jd)).forEach(function(f){for(a=0;a0&&(i+=g(b.values[f].value)-h)}),i}}function zd(a,b){return dh?dh:b?2*a.tickOffset()*eh/b:0}function Ad(a,b){var d=c(a)?uc():a;"string"==typeof d&&(d=[d]);for(var e=0;e0}function Xd(a,b){var c=!1;return Object.keys(a).forEach(function(d){a[d]===b&&(c=!0)}),c}function Yd(a,b){return Math.pow(Df(a.x)-b[0],2)+Math.pow(Ef(a.value)-b[1],2)}function Zd(a,b){var c=0;a.each(function(){++c}).each("end",function(){--c||b.apply(this,arguments)})}function $d(a,b,c){fg(b,a.node()),fi.select("."+f.selectedCircles+Uc(b.id)).selectAll("."+f.selectedCircle+"-"+c).data([b]).enter().append("circle").attr("class",function(){return Gc(f.selectedCircle,c)}).attr("cx",qg?ud:td).attr("cy",qg?td:ud).attr("stroke",function(){return Lh(b.id)}).attr("r",1.4*ch).transition().duration(100).attr("r",ch)}function _d(a,b,c){gg(b,a.node()),fi.select("."+f.selectedCircles+Uc(b.id)).selectAll("."+f.selectedCircle+"-"+c).transition().duration(100).attr("r",0).remove()}function ae(a,b,c,d){a?$d(b,c,d):_d(b,c,d)}function be(a,b){fg(b,a.node()),a.transition().duration(100).style("fill",function(){return Qe.rgb(Lh(b.id)).darker(1)})}function ce(a,b){gg(b,a.node()),a.transition().duration(100).style("fill",function(){return Lh(b.id)})}function de(a,b,c,d){a?be(b,c,d):ce(b,c,d)}function ee(a){return a.filter(function(a){return b(a.value)})}function fe(a,c){return(c?fi.selectAll("."+f.circles+Uc(c)):fi).selectAll("."+f.circle+(b(a)?"-"+a:""))}function ge(a,b){fe(a,b).classed(f.EXPANDED,!0).attr("r",bh)}function he(a){fe(a).filter(function(){return Qe.select(this).classed(f.EXPANDED)}).classed(f.EXPANDED,!1).attr("r",$g)}function ie(a){return fi.selectAll("."+f.bar+(b(a)?"-"+a:""))}function je(a){ie(a).classed(f.EXPANDED,!0)}function ke(a){ie(a).classed(f.EXPANDED,!1)}function le(a,b){var c=pe(a,b);return function(a,b){var d=c(a,b),e=qg?1:0,f=qg?0:1,g="M "+d[0][e]+","+d[0][f]+" L"+d[1][e]+","+d[1][f]+" L"+d[2][e]+","+d[2][f]+" L"+d[3][e]+","+d[3][f]+" z";return g}}function me(a,b){var c=pe(a,!1),d=b?ne:oe;return function(a,b){return d(c(a,b),a,this)}}function ne(a,b){var c;return qg?(c=Jd(b)?4:6,a[2][1]+c*(b.value<0?-1:1)):a[0][0]+(a[2][0]-a[0][0])/2}function oe(a,b,c){var d=c.getBBox();return qg?(a[0][0]+a[2][0]+.6*d.height)/2:a[2][1]+(b.value<0?d.height:Jd(b)?-3:-6)}function pe(a,b){var c=a.__max__+1,d=zd(Jf,c),e=wd(d,c,a,!!b),f=xd(!!b),g=yd(a,!!b),h=b?V:U;return function(a,b){var c=h(a.id)(0),i=g(a,b)||c,j=e(a),k=f(a);return qg&&(a.value>0&&i>k||a.value<0&&k>i)&&(k=i),[[j,i],[j,k-(c-i)],[j+d,k-(c-i)],[j+d,i]]}}function qe(a,b,e,f){var g,h,i,j,k,l,m,n,o,p,q,r=-1,s="M",t=[];if(d(f))for(g=0;g=h;h+=u)s+=i(a[g-1],a[g],h,o)}r=a[g].x}return s}function re(b){var c,d,e;if(ji=Qe.select(Te),ji.empty())throw new Error('No bind element found. Check the selector specified by "bindto" and existance of that element. Default "bindto" is "#chart".');if(ji.html(""),ji.classed("c3",!0),Re.data.x={},Re.data.targets=oc(b),n(),Q(),Df.domain(Qe.extent(Yb(Re.data.targets))),Ef.domain(Tb(Re.data.targets,"y")),Ff.domain(Tb(Re.data.targets,"y2")),Gf.domain(Df.domain()),Hf.domain(Ef.domain()),If.domain(Ff.domain()),ki=Df.domain(),$h.scale(Gf),Ye&&ci.scale(Df),di=ji.append("svg").attr("width",ff+cf.left+cf.right).attr("height",hf+cf.top+cf.bottom).on("mouseenter",_e).on("mouseleave",af),ei=di.append("defs"),ei.append("clipPath").attr("id",yh).append("rect").attr("width",ff).attr("height",hf),ei.append("clipPath").attr("id",zh).append("rect").attr("x",A).attr("y",B).attr("width",G).attr("height",H),ei.append("clipPath").attr("id",Ah).append("rect").attr("x",C).attr("y",D).attr("width",I).attr("height",J),fi=di.append("g").attr("transform",Sh.main),gi=jg?di.append("g").attr("transform",Sh.context):null,hi=mg?di.append("g").attr("transform",Sh.legend):null,ii=Qe.select(Te).style("position","relative").append("div").style("position","absolute").style("pointer-events","none").style("z-index","10").style("display","none"),fi.append("g").attr("class",f.axisX).attr("clip-path",qg?"":Ch).attr("transform",Sh.x).append("text").attr("class",f.axisXLabel).attr("transform",qg?"rotate(-90)":"").attr("dx",qb).attr("dy",tb).style("text-anchor",wb),Bg&&fi.append("g").attr("class",f.axisY).attr("clip-path",qg?Dh:"").append("text").attr("class",f.axisYLabel).attr("transform",qg?"":"rotate(-90)").attr("dx",rb).attr("dy",ub).style("text-anchor",xb),Kg&&fi.append("g").attr("class",f.axisY2).attr("transform",Sh.y2).append("text").attr("class",f.axisY2Label).attr("transform",qg?"":"rotate(-90)").attr("dx",sb).style("text-anchor",yb),d=fi.append("g").attr("clip-path",Bh).attr("class",f.grid),Tg&&d.append("g").attr("class",f.xgrids),Wd(Vg)&&d.append("g").attr("class",f.xgridLines),_g&&d.append("g").attr("class",f.xgridFocus).append("line").attr("class",f.xgridFocus).attr("x1",qg?0:-10).attr("x2",qg?ff:-10).attr("y1",qg?-10:cf.top).attr("y2",qg?-10:hf),Wg&&d.append("g").attr("class",f.ygrids),Wd(Xg)&&d.append("g").attr("class",f.ygridLines),fi.append("g").attr("clip-path",Bh).attr("class",f.regions),fi.append("g").attr("clip-path",Bh).attr("class",f.chart),c=fi.select("."+f.chart).append("g").attr("class",f.eventRects).style("fill-opacity",0).style("cursor",Ye?qg?"ns-resize":"ew-resize":null),fi.select("."+f.chart).append("g").attr("class",f.chartBars),fi.select("."+f.chart).append("g").attr("class",f.chartLines),fi.select("."+f.chart).append("g").attr("class",f.chartArcs).attr("transform",Sh.arc).append("text").attr("class",f.chartArcsTitle).style("text-anchor","middle").text(Nb()),fi.select("."+f.chart).append("g").attr("class",f.chartTexts),Ye&&fi.insert("rect",$e?null:"g."+f.grid).attr("class",f.zoomRect).attr("width",ff).attr("height",hf).style("opacity",0).style("cursor",qg?"ns-resize":"ew-resize").call(ci).on("dblclick.zoom",null),zg&&$h.extent("function"!=typeof zg?zg:zg(Yb())),jg&&(gi.append("g").attr("clip-path",Bh).attr("class",f.chart),gi.select("."+f.chart).append("g").attr("class",f.chartBars),gi.select("."+f.chart).append("g").attr("class",f.chartLines),gi.append("g").attr("clip-path",Bh).attr("class",f.brush).call($h).selectAll("rect").attr(qg?"width":"height",qg?gf:jf),gi.append("g").attr("class",f.axisX).attr("transform",Sh.subx).attr("clip-path",qg?"":Ch)),Ee(Re.data.targets),qg?fi.select("."+f.axisX).style("opacity",0).call(Jf):(fi.select("."+f.axisY).style("opacity",0).call(Kf),fi.select("."+f.axisY2).style("opacity",0).call(Lf)),De({withTransform:!0,withLegend:!0,durationForAxis:0}),vh){if(Eh&&"string"==typeof wh){for(wh=Sd(wh),e=0;e0){d=[];for(var g in Rf)for(c=0;cg&&h>c&&d>i&&j>d):"path"===this.nodeName&&(m=ld(this),c=m.x,d=m.y,e=m.width,k=m.height,l=de,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 we(a){Gd(Re.data.targets)||$f&&(Hh=a,fi.select("."+f.chart).append("rect").attr("class",f.dragarea).style("opacity",.1),Ih=!0,hg())}function xe(){Gd(Re.data.targets)||$f&&(fi.select("."+f.dragarea).transition().duration(100).style("opacity",0).remove(),fi.selectAll("."+f.shape).classed(f.INCLUDED,!1),Ih=!1,ig())}function ye(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=vd(),J=Gd(Re.data.targets),L=yc(Re.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?bf:0,G=d(a.durationForExit)?a.durationForExit:F,H=d(a.durationForAxis)?a.durationForAxis:F,A&&mg&&Me(Re.data.targets,a),z&&(Df.domain(Qe.extent(Yb(L))),ki=Df.domain(),Ye&&ci.scale(Df).updateScaleExtent(),Gf.domain(Df.domain()),$h.scale(Gf)),y&&(Df.domain($h.empty()?ki:$h.extent()),Ye&&ci.scale(Df).updateScaleExtent()),Ef.domain(Tb(L,"y")),Ff.domain(Tb(L,"y2")),fi.select("."+f.axisX).style("opacity",J?0:1).transition().duration(H).call(Jf),fi.select("."+f.axisY).style("opacity",J?0:1).transition().duration(H).call(Kf),fi.select("."+f.axisY2).style("opacity",J?0:1).transition().duration(H).call(Lf),B=le(I),D=me(I,!0),E=me(I,!1),fi.select("."+f.axisX+" ."+f.axisXLabel).attr("x",nb).text(hb),fi.select("."+f.axisY+" ."+f.axisYLabel).attr("x",ob).attr("dy",ub).text(ib),fi.select("."+f.axisY2+" ."+f.axisY2Label).attr("x",pb).attr("dy",vb).text(jb),Hf.domain(Ef.domain()),If.domain(Ff.domain()),ii.style("display","none"),fi.select("line."+f.xgridFocus).style("visibility","hidden"),Tg){if("year"===Ug){e=[];for(var M=Yb(),N=M[0].getFullYear(),O=M[1].getFullYear(),P=N;O>=P;P++)e.push(new Date(P+"-01-01 00:00:00"))}else e=Df.ticks(10);c=fi.select("."+f.xgrids).selectAll("."+f.xgrid).data(e),c.enter().append("line").attr("class",f.xgrid),c.attr("x1",qg?0:function(a){return Df(a)-Jf.tickOffset()}).attr("x2",qg?ff:function(a){return Df(a)-Jf.tickOffset()}).attr("y1",qg?function(a){return Df(a)-Jf.tickOffset()}:cf.top).attr("y2",qg?function(a){return Df(a)-Jf.tickOffset()}:hf).style("opacity",function(){return+Qe.select(this).attr(qg?"y1":"x1")===(qg?hf:0)?0:1}),c.exit().remove()}Wd(Vg)&&(g=fi.select("."+f.xgridLines).selectAll("."+f.xgridLine).data(Vg),h=g.enter().append("g").attr("class",function(a){return f.xgridLine+(a.class?a.class:"")}),h.append("line").style("opacity",0),h.append("text").attr("text-anchor","end").attr("transform",qg?"":"rotate(-90)").attr("dx",qg?0:-cf.top).attr("dy",-5).style("opacity",0),g.select("line").transition().duration(F).attr("x1",qg?0:ed).attr("x2",qg?ff:ed).attr("y1",qg?ed:cf.top).attr("y2",qg?ed:hf).style("opacity",1),g.select("text").transition().duration(F).attr("x",qg?ff:0).attr("y",ed).text(function(a){return a.text}).style("opacity",1),g.exit().transition().duration(F).style("opacity",0).remove()),u&&Wg&&(i=fi.select("."+f.ygrids).selectAll("."+f.ygrid).data(Ef.ticks(Yg)),i.enter().append("line").attr("class",f.ygrid),i.attr("x1",qg?Ef:0).attr("x2",qg?Ef:ff).attr("y1",qg?0:Ef).attr("y2",qg?hf:Ef),i.exit().remove()),u&&Wd(Xg)&&(j=fi.select("."+f.ygridLines).selectAll("."+f.ygridLine).data(Xg),k=j.enter().append("g").attr("class",function(a){return f.ygridLine+(a.class?a.class:"")}),k.append("line").style("opacity",0),k.append("text").attr("text-anchor","end").attr("transform",qg?"rotate(-90)":"").attr("dx",qg?0:-cf.top).attr("dy",-5).style("opacity",0),j.select("line").transition().duration(F).attr("x1",qg?fd:0).attr("x2",qg?fd:ff).attr("y1",qg?0:fd).attr("y2",qg?hf:fd).style("opacity",1),j.select("text").transition().duration(F).attr("x",qg?0:ff).attr("y",fd).text(function(a){return a.text}).style("opacity",1),j.exit().transition().duration(F).style("opacity",0).remove()),m=fi.selectAll("."+f.bars).selectAll("."+f.bar).data(Od),m.enter().append("path").attr("d",B).style("stroke","none").style("opacity",0).style("fill",function(a){return Lh(a.id)}).attr("class",Oc),m.style("opacity",Wc).transition().duration(F).attr("d",B).style("opacity",1),m.exit().transition().duration(G).style("opacity",0).remove(),o=fi.selectAll("."+f.texts).selectAll("."+f.text).data(Qd),o.enter().append("text").attr("class",Hc).attr("text-anchor",function(a){return qg?a.value<0?"end":"start":"middle"}).style("stroke","none").style("fill-opacity",0),o.text(function(a){return cd(a.id)(a.value)}).style("fill-opacity",Xc).transition().duration(F).attr("x",D).attr("y",E).style("fill-opacity",Zc),o.exit().transition().duration(G).style("fill-opacity",0).remove(),fi.selectAll("."+f.line).style("opacity",Wc).transition().duration(F).attr("d",_h).style("opacity",1),fi.selectAll("."+f.area).style("opacity",0).transition().duration(F).attr("d",ai).style("opacity",li),l=fi.selectAll("."+f.circles).selectAll("."+f.circle).data(Pd),l.enter().append("circle").attr("class",Mc).style("opacity",0).attr("r",$g),l.style("opacity",Wc).transition().duration(F).style("opacity",Yc).attr("cx",qg?ud:td).attr("cy",qg?td:ud),l.exit().remove(),fi.selectAll("."+f.chartArc).select("."+f.arc).attr("transform",x?"scale(0)":"").style("opacity",function(a){return a===this._current?0:1}).transition().duration(F).attrTween("d",function(a){var b,c=Bb(a);return c?(b=Qe.interpolate(this._current,c),this._current=b(0),function(a){return Eb(b(a),!0)}):function(){return"M 0 0"}}).attr("transform",x?"scale(1)":"").style("opacity",1),fi.selectAll("."+f.chartArc).select("text").attr("transform",Fb).style("opacity",0).transition().duration(F).text(Ib).style("opacity",function(a){return xc(a.data.id)&&Nd(a.data)?1:0}),fi.select("."+f.chartArcsTitle).style("opacity",Fd(Re.data.targets)?1:0),jg&&(null!==Qe.event&&"zoom"===Qe.event.type&&$h.extent(Df.orgDomain()).update(),v&&(gi.select("."+f.axisX).style("opacity",J?0:1).transition().duration(F).call(Mf),$h.empty()||$h.extent(Df.orgDomain()).update(),C=le(I,!0),p=gi.selectAll("."+f.bars).selectAll("."+f.bar).data(Od),p.enter().append("path").attr("d",C).style("stroke","none").style("fill",function(a){return Lh(a.id)}).attr("class",Oc),p.style("opacity",Wc).transition().duration(F).attr("d",C).style("opacity",1),p.exit().transition().duration(F).style("opacity",0).remove(),gi.selectAll("."+f.line).style("opacity",Wc).transition().duration(F).attr("d",bi).style("opacity",1))),fi.selectAll("."+f.selectedCircles).filter(function(a){return Jd(a)}).selectAll("circle").remove(),fi.selectAll("."+f.selectedCircle).transition().duration(F).attr("cx",qg?ud:td).attr("cy",qg?td:ud),Wd(Of)?(q=fi.select("."+f.eventRects).selectAll("."+f.eventRect).data([0]),te(q.enter()),q.attr("x",0).attr("y",0).attr("width",ff).attr("height",hf)):(Gh&&!Fh?(t=function(a,b){var c=qc(b),d=rc(b),e=Re.data.x[a.id][b];return(Df(d?d:e+50)-Df(c?c:e-50))/2},s=function(a,b){var c=qc(b),d=Re.data.x[a.id][b];return(Df(d)+Df(c?c:d-50))/2}):(t=K(),s=function(a){return Df(a.x)-t/2}),r=tc(),fi.select("."+f.eventRects).datum(r?r.values:[]),q=fi.select("."+f.eventRects).selectAll("."+f.eventRect).data(function(a){return a}),se(q.enter()),q.attr("class",Tc).attr("x",qg?0:s).attr("y",qg?s:0).attr("width",qg?ff:t).attr("height",qg?t:hf),q.exit().remove()),n=fi.select("."+f.regions).selectAll("rect."+f.region).data(qh),n.enter().append("rect").style("fill-opacity",0),n.attr("class",Sc).attr("x",qg?0:bc).attr("y",qg?bc:cf.top).attr("width",qg?ff:cc).attr("height",qg?cc:hf).transition().duration(F).style("fill-opacity",function(a){return b(a.opacity)?a.opacity:.1}),n.exit().transition().duration(F).style("fill-opacity",0).remove(),uc().forEach(function(a){mi[a]=!0})}}function ze(){ye({withTransition:!1,withY:!1,withSubchart:!1,withUpdateXDomain:!0})}function Ae(){return"mousemove"===Qe.event.sourceEvent.type&&ci.altDomain?(Df.domain(ci.altDomain),void ci.scale(Df).updateScaleExtent()):(Fh&&Df.orgDomain()[0]===ki[0]&&Df.domain([ki[0]-1e-10,Df.orgDomain()[1]]),ye({withTransition:!1,withY:!1,withSubchart:!1}),void("mousemove"===Qe.event.sourceEvent.type&&(Jh=!0)))}function Be(){function a(){b.forEach(function(a){a()})}var b=[];return a.add=function(a){b.push(a)},a}function Ce(){di.attr("width",kf).attr("height",lf),di.select("#"+yh).select("rect").attr("width",ff).attr("height",hf),di.select("#"+zh).select("rect").attr("width",G),di.select("#"+Ah).select("rect").attr("width",I),di.select("."+f.zoomRect).attr("width",ff).attr("height",hf)}function De(a){a=d(a)?a:{},a.withTransition=d(a.withTransition)?a.withTransition:!0,a.withTransform=d(a.withTransform)?a.withTransform:!1,a.withLegend=d(a.withLegend)?a.withLegend:!1,a.withUpdateXDomain=!0,a.withUpdateOrgXDomain=!0,a.durationForExit=0,n(),Q(),Ce(),m(a.withTransition),ye(a)}function Ee(a){var b,c,d,e,g,h,i,j,k,l,m,n;i=fi.select("."+f.chartTexts).selectAll("."+f.chartText).data(a),j=i.enter().append("g").attr("class",function(a){return f.chartText+Gc(f.target,a.id)}).style("pointer-events","none"),j.append("g").attr("class",Ic).style("fill",function(a){return Lh(a.id)}),e=fi.select("."+f.chartBars).selectAll("."+f.chartBar).data(a),d=e.enter().append("g").attr("class",function(a){return f.chartBar+Gc(f.target,a.id)}).style("pointer-events","none"),d.append("g").attr("class",Pc).style("fill",function(a){return Lh(a.id)}).style("stroke","none").style("cursor",function(a){return ag(a)?"pointer":null}),c=fi.select("."+f.chartLines).selectAll("."+f.chartLine).data(a),b=c.enter().append("g").attr("class",function(a){return f.chartLine+Gc(f.target,a.id)}).style("pointer-events","none"),b.append("path").attr("class",Lc).style("opacity",0).style("stroke",function(a){return Lh(a.id)}),b.append("path").attr("class",Rc).style("opacity",function(){return li=+Qe.select(this).style("opacity"),0}).style("fill",function(a){return Lh(a.id)}),b.append("g").attr("class",function(a){return Gc(f.selectedCircles,a.id)}),b.append("g").attr("class",Nc).style("fill",function(a){return Lh(a.id)}).style("cursor",function(a){return ag(a)?"pointer":null}),a.forEach(function(a){fi.selectAll("."+f.selectedCircles+Uc(a.id)).selectAll("."+f.selectedCircle).each(function(b,c){b.value=a.values[c].value})}),h=fi.select("."+f.chartArcs).selectAll("."+f.chartArc).data(uf(a)),g=h.enter().append("g").attr("class",function(a){return f.chartArc+Gc(f.target,a.data.id)}),g.append("path").attr("class",Qc).style("opacity",0).style("fill",function(a){return Lh(a.data.id)}).style("cursor",function(a){return ag(a)?"pointer":null}).each(function(a){this._current=a}).on("mouseover",function(a,b){var c=Bb(a),d=Hb(c),e=Pb();Jb(c.data.id),Je(c.data.id),e(d,b)}).on("mousemove",function(a){var b=Bb(a),c=[Hb(b)];pd(c,Qe.mouse(this))}).on("mouseout",function(a,b){var c=Bb(a),d=Hb(c),e=Qb();Kb(c.data.id),Le(),qd(),e(d,b)}).on("click",function(a,b){var c=Bb(a),d=Hb(c),e=Ob();e(d,b)}),g.append("text").attr("dy",".35em").style("opacity",0).style("text-anchor","middle").style("pointer-events","none"),jg&&(n=gi.select("."+f.chartBars).selectAll("."+f.chartBar).data(a),m=n.enter().append("g").attr("class",function(a){return f.chartBar+Gc(f.target,a.id)}),m.append("g").attr("class",Pc).style("fill",function(a){return Lh(a.id)}),l=gi.select("."+f.chartLines).selectAll("."+f.chartLine).data(a),k=l.enter().append("g").attr("class",function(a){return f.chartLine+Gc(f.target,a.id)}),k.append("path").attr("class",Lc).style("opacity",0).style("stroke",function(a){return Lh(a.id)})),di.selectAll("."+f.target).filter(function(a){return xc(a.id)}).transition().style("opacity",1)}function Fe(a,b){Re.data.targets.forEach(function(b){for(var c=0;ce&&(e=(k-j)/2,w=0,C++)),B[a]=C,A[C]=e,x[a]=w,w+=j}var e,f,g=a.getBBox(),h=10*Math.ceil((g.width+s)/10),i=10*Math.ceil((g.height+r)/10),j=Th?i:h,k=Th?mf:nf;c&&(w=0,C=0,t=0,u=0),y[b]=h,z[b]=i,(!t||h>=t)&&(t=h),(!u||i>=u)&&(u=i),f=Th?u:t,pg?(Object.keys(y).forEach(function(a){y[a]=t}),Object.keys(z).forEach(function(a){z[a]=u}),e=(k-f*q.length)/2,v>e?(w=0,C=0,q.forEach(function(a){d(a)})):d(b,!0)):d(b)}var g,h,i,j,k,l,o,p,q=uc(a),r=4,s=26,t=0,u=0,v=10,w=0,x={},y={},z={},A={},B={},C=0;b=c(b)?{}:b,p=d(b.withTransition)?b.withTransition:!0,Th?(h=function(a){return t*(.2+B[a])},k=function(a){return A[B[a]]+x[a]}):(h=function(a){return A[B[a]]+x[a]},k=function(a){return u*(.2+B[a])}),i=function(a,b){return h(a,b)+14},l=function(a,b){return k(a,b)+9},j=function(a,b){return h(a,b)-4},o=function(a,b){return k(a,b)-7},g=hi.selectAll("."+f.legendItem).data(q).enter().append("g").attr("class",function(a){return Gc(f.legendItem,a)}).style("cursor","pointer").on("click",function(a){"function"==typeof og?og(a):Re.toggle(a)}).on("mouseover",function(a){Re.focus(a)}).on("mouseout",function(){Re.revert()}),g.append("text").text(function(a){return d(Rf[a])?Rf[a]:a}).each(function(a,b){e(this,a,0===b)}).style("pointer-events","none").attr("x",Th?i:-200).attr("y",Th?-200:l),g.append("rect").attr("class",f.legendItemEvent).style("fill-opacity",0).attr("x",Th?j:-200).attr("y",Th?-200:o).attr("width",function(a){return y[a]}).attr("height",function(a){return z[a]}),g.append("rect").attr("class",f.legendItemTile).style("pointer-events","none").style("fill",function(a){return Lh(a)}).attr("x",Th?i:-200).attr("y",Th?-200:k).attr("width",10).attr("height",10),hi.selectAll("text").data(q).text(function(a){return d(Rf[a])?Rf[a]:a}).each(function(a,b){e(this,a,0===b)}).transition().duration(p?250:0).attr("x",i).attr("y",l),hi.selectAll("rect."+f.legendItemEvent).data(q).transition().duration(p?250:0).attr("x",j).attr("y",o),hi.selectAll("rect."+f.legendItemTile).data(q).transition().duration(p?250:0).attr("x",h).attr("y",k),M(t),N(u),L(C),n(),Q(),Ce(),m(!1)}function Ne(a){return vc(a.id)}function Oe(a){return"data"in a&&vc(a.data.id)}function Pe(a){var b=a&&a.value?a.value:null,c=a&&a["class"]?a["class"]:null;return b?function(a){return a.value!==b}:c?function(a){return a["class"]!==c}:function(){return!0}}var Qe=a.d3?a.d3:a.require?a.require("d3"):void 0,Re={data:{},axis:{}},Se={},Te=h(["bindto"],"#chart"),Ue=h(["size","width"]),Ve=h(["size","height"]),We=h(["padding","left"]),Xe=h(["padding","right"]),Ye=h(["zoom","enabled"],!1),Ze=h(["zoom","extent"]),$e=h(["zoom","privileged"],!1),_e=h(["onenter"],function(){}),af=h(["onleave"],function(){}),bf=h(["transition","duration"],350);g("data","data is required in config");var cf,df,ef,ff,gf,hf,jf,kf,lf,mf,nf,of,pf,qf,rf,sf,tf,uf,vf,wf,xf,yf,zf,Af,Bf,Cf,Df,Ef,Ff,Gf,Hf,If,Jf,Kf,Lf,Mf,Nf=h(["data","x"]),Of=h(["data","xs"],{}),Pf=h(["data","x_format"],"%Y-%m-%d"),Qf=h(["data","id_converter"],function(a){return a}),Rf=h(["data","names"],{}),Sf=h(["data","groups"],[]),Tf=h(["data","axes"],{}),Uf=h(["data","type"]),Vf=h(["data","types"],{}),Wf=h(["data","labels"],{}),Xf=h(["data","order"]),Yf=h(["data","regions"],{}),Zf=h(["data","colors"],{}),$f=h(["data","selection","enabled"],!1),_f=h(["data","selection","grouped"],!1),ag=h(["data","selection","isselectable"],function(){return!0}),bg=h(["data","selection","multiple"],!0),cg=h(["data","onclick"],function(){}),dg=h(["data","onenter"],function(){}),eg=h(["data","onleave"],function(){}),fg=h(["data","onselected"],function(){}),gg=h(["data","onunselected"],function(){}),hg=h(["data","ondragstart"],function(){}),ig=h(["data","ondragend"],function(){}),jg=h(["subchart","show"],!1),kg=jg?h(["subchart","size","height"],60):0,lg=h(["color","pattern"],[]),mg=h(["legend","show"],!0),ng=h(["legend","position"],"bottom"),og=h(["legend","item","onclick"]),pg=h(["legend","equally"],!1),qg=h(["axis","rotated"],!1),rg=h(["axis","x","type"],"indexed"),sg=h(["axis","x","categories"],[]),tg=h(["axis","x","tick","centered"],!1),ug=h(["axis","x","tick","format"]),vg=h(["axis","x","tick","culling"],"categorized"===rg?!1:!0),wg=h(["axis","x","tick","count"],10),xg=h(["axis","x","max"]),yg=h(["axis","x","min"]),zg=h(["axis","x","default"]),Ag=h(["axis","x","label"],{}),Bg=h(["axis","y","show"],!0),Cg=h(["axis","y","max"]),Dg=h(["axis","y","min"]),Eg=h(["axis","y","center"]),Fg=h(["axis","y","label"],{}),Gg=h(["axis","y","inner"],!1),Hg=h(["axis","y","tick","format"]),Ig=h(["axis","y","padding"]),Jg=h(["axis","y","ticks"],10),Kg=h(["axis","y2","show"],!1),Lg=h(["axis","y2","max"]),Mg=h(["axis","y2","min"]),Ng=h(["axis","y2","center"]),Og=h(["axis","y2","label"],{}),Pg=h(["axis","y2","inner"],!1),Qg=h(["axis","y2","tick","format"]),Rg=h(["axis","y2","padding"]),Sg=h(["axis","y2","ticks"],10),Tg=h(["grid","x","show"],!1),Ug=h(["grid","x","type"],"tick"),Vg=h(["grid","x","lines"],[]),Wg=h(["grid","y","show"],!1),Xg=h(["grid","y","lines"],[]),Yg=h(["grid","y","ticks"],10),Zg=h(["point","show"],!0),$g=Zg?h(["point","r"],2.5):0,_g=h(["point","focus","line","enabled"],!0),ah=h(["point","focus","expand","enabled"],!0),bh=h(["point","focus","expand","r"],ah?4:$g),ch=h(["point","focus","select","r"],8),dh=h(["bar","width"]),eh=h(["bar","width","ratio"],.6),fh=h(["pie","label","show"],!0),gh=h(["pie","label","format"]),hh=h(["pie","onclick"],function(){}),ih=h(["pie","onmouseover"],function(){}),jh=h(["pie","onmouseout"],function(){}),kh=h(["donut","label","show"],!0),lh=h(["donut","label","format"]),mh=h(["donut","title"],""),nh=h(["donut","onclick"],function(){}),oh=h(["donut","onmouseover"],function(){}),ph=h(["donut","onmouseout"],function(){}),qh=h(["regions"],[]),rh=h(["tooltip","show"],!0),sh=h(["tooltip","format","title"]),th=h(["tooltip","format","value"]),uh=h(["tooltip","contents"],function(a,b,c,d){var e,g,h,i,j,k=sh?sh:b,l=th?th:c;for(g=0;g"+(h||0===h?""+h+"":"")),j=a[g].name,i=l(a[g].value,a[g].ratio),e+="",e+=""+j+"",e+=""+i+"",e+="");return e+""}),vh=h(["tooltip","init","show"],!1),wh=h(["tooltip","init","x"],0),xh=h(["tooltip","init","position"],{top:"0px",left:"50px"}),yh=("string"==typeof Te?Te.replace("#",""):Te.id)+"-clip",zh=yh+"-xaxis",Ah=yh+"-yaxis",Bh=i(yh),Ch=i(Ch),Dh=i(Dh),Eh="timeseries"===rg,Fh="categorized"===rg,Gh=!Eh&&(Nf||Wd(Of)),Hh=null,Ih=!1,Jh=!1,Kh=!1,Lh=Rd(Zf,lg),Mh=function(){var a=[[Qe.time.format("%Y/%-m/%-d"),function(){return!0}],[Qe.time.format("%-m/%-d"),function(a){return a.getMonth()}],[Qe.time.format("%-m/%-d"),function(a){return 1!==a.getDate()}],[Qe.time.format("%-m/%-d"),function(a){return a.getDay()&&1!==a.getDate()}],[Qe.time.format("%I %p"),function(a){return a.getHours()}],[Qe.time.format("%I:%M"),function(a){return a.getMinutes()}],[Qe.time.format(":%S"),function(a){return a.getSeconds()}],[Qe.time.format(".%L"),function(a){return a.getMilliseconds()}]];return function(b){for(var c=a.length-1,d=a[c];!d[1](b);)d=a[--c];return d[0](b)}}(),Nh=[],Oh=qg?"left":"bottom",Ph=qg?Gg?"top":"bottom":Gg?"right":"left",Qh=qg?Pg?"bottom":"top":Pg?"left":"right",Rh=qg?"left":"bottom",Sh={main:function(){return"translate("+cf.left+","+cf.top+")"},context:function(){return"translate("+df.left+","+df.top+")"},legend:function(){return"translate("+ef.left+","+ef.top+")"},x:function(){return"translate(0,"+(qg?0:hf)+")"},y:function(){return"translate(0,"+(qg?hf:0)+")"},y2:function(){return"translate("+(qg?0:ff)+","+(qg?1:0)+")"},subx:function(){return"translate(0,"+(qg?0:jf)+")"},arc:function(){return"translate("+ff/2+","+hf/2+")"}},Th="right"===ng,Uh=0,Vh=0,Wh=0,Xh=30,Yh=30,Zh=5;uf=Qe.layout.pie().value(function(a){return a.values.reduce(function(a,b){return a+b.value},0)});var $h,_h=function(){var a=Qe.svg.line().x(qg?function(a){return U(a.id)(a.value)}:dd).y(qg?dd:function(a){return U(a.id)(a.value)});return function(b){var c,d,e=ee(b.values);return Hd(b)?(a.interpolate(Id(b)?"cardinal":"linear"),Yf[b.id]?qe(e,Df,U(b.id),Yf[b.id]):a(e)):(c=Df(e[0].x),d=U(b.id)(e[0].value),qg?"M "+d+" "+c:"M "+c+" "+d)}}(),ai=function(){var a;return a=qg?Qe.svg.area().x0(function(a){return U(a.id)(0)}).x1(function(a){return U(a.id)(a.value)}).y(dd):Qe.svg.area().x(dd).y0(function(a){return U(a.id)(0)}).y1(function(a){return U(a.id)(a.value)}),function(b){var c,d,e=ee(b.values);return Bd([b],"area")||Bd([b],"area-spline")?(a.interpolate(Id(b)?"cardinal":"linear"),a(e)):(c=Df(e[0].x),d=U(b.id)(e[0].value),qg?"M "+d+" "+c:"M "+c+" "+d)}}(),bi=function(){var a=Qe.svg.line().x(qg?function(a){return V(a.id)(a.value)}:gd).y(qg?gd:function(a){return V(a.id)(a.value)});return function(b){var c=ee(b.values);return Hd(b)?a(c):"M "+Gf(c[0].x)+" "+V(b.id)(c[0].value)}}(),ci=function(){};$h=Qe.svg.brush().on("brush",ze),$h.update=function(){return gi&&gi.select("."+f.brush).call(this),this},$h.scale=function(a){return qg?this.y(a):this.x(a)},Ye&&(ci=Qe.behavior.zoom().on("zoomstart",function(){ci.altDomain=Qe.event.sourceEvent.altKey?Df.orgDomain():null}).on("zoom",Ye?Ae:null),ci.scale=function(a){return qg?this.y(a):this.x(a)},ci.orgScaleExtent=function(){var a=Ze?Ze:[1,10];return[a[0],Math.max(sc()/a[1],a[1])]},ci.updateScaleExtent=function(){var a=Zb(Df.orgDomain())/Zb(ki),b=this.orgScaleExtent();return this.scaleExtent([b[0]*a,b[1]*a]),this});var di,ei,fi,gi,hi,ii,ji,ki,li,mi={};if(Re.focus=function(a){function b(a){yc(a).transition().duration(100).style("opacity",1)}var c=di.selectAll(Vc(a)),d=c.filter(Ne),e=c.filter(Oe);Re.revert(),Re.defocus(),b(d.classed(f.focused,!0)),b(e),Gd(Re.data.targets)&&Jb(a,!0),Je(a)},Re.defocus=function(a){function b(a){yc(a).transition().duration(100).style("opacity",.3)}var c=di.selectAll(Vc(a)),d=c.filter(Ne),e=c.filter(Oe);Re.revert(),b(d.classed(f.focused,!1)),b(e),Gd(Re.data.targets)&&Kb(a),Ke(a)},Re.revert=function(a){function b(a){yc(a).transition().duration(100).style("opacity",1)}var c=di.selectAll(Vc(a)),d=c.filter(Ne),e=c.filter(Oe);b(d.classed(f.focused,!1)),b(e),Gd(Re.data.targets)&&Kb(a),Le()},Re.show=function(a){Ac(a),di.selectAll(Vc(a)).transition().style("opacity",1),ye({withUpdateOrgXDomain:!0,withUpdateXDomain:!0,withLegend:!1})},Re.hide=function(a){zc(a),di.selectAll(Vc(a)).transition().style("opacity",0),ye({withUpdateOrgXDomain:!0,withUpdateXDomain:!0,withLegend:!1})},Re.toggle=function(a){xc(a)?Re.hide(a):Re.show(a)},Re.unzoom=function(){$h.clear().update(),ye({withUpdateXDomain:!0})},Re.load=function(a){return a.xs&&hc(a.xs),"categories"in a&&Fh&&(sg=a.categories,Jf.categories(sg)),"cacheIds"in a&&$b(a.cacheIds)?void Fe(ac(a.cacheIds),a.done):void("unload"in a?He("string"==typeof a.unload?[a.unload]:"boolean"==typeof a.unload&&a.unload?uc():a.unload,function(){Ge(a)}):Ge(a))},Re.unload=function(a){He(a?"string"==typeof a?[a]:a:uc(),function(){ye({withUpdateOrgXDomain:!0,withUpdateXDomain:!0,withLegend:!0})})},Re.selected=function(a){return Qe.merge(fi.selectAll("."+f.shapes+Uc(a)).selectAll("."+f.shape).filter(function(){return Qe.select(this).classed(f.SELECTED)}).map(function(a){return a.map(function(a){return a.__data__})}))},Re.select=function(a,b,c){$f&&fi.selectAll("."+f.shapes).selectAll("."+f.shape).each(function(e,g){var h=Qe.select(this),i="circle"===this.nodeName?$d:be,j="circle"===this.nodeName?_d:ce,k=_f||!a||a.indexOf(e.id)>=0,l=!b||b.indexOf(g)>=0,m=h.classed(f.SELECTED);k&&l?ag(e)&&!m&&i(h.classed(f.SELECTED,!0),e,g):d(c)&&c&&m&&j(h.classed(f.SELECTED,!1),e,g)})},Re.unselect=function(a,b){$f&&fi.selectAll("."+f.shapes).selectAll("."+f.shape).each(function(c,d){var e=Qe.select(this),g="circle"===this.nodeName?_d:ce,h=_f||!a||a.indexOf(c.id)>=0,i=!b||b.indexOf(d)>=0,j=e.classed(f.SELECTED);h&&i&&ag(c)&&j&&g(e.classed(f.SELECTED,!1),c,d)})},Re.toLine=function(a){Ad(a,"line"),De()},Re.toSpline=function(a){Ad(a,"spline"),De()},Re.toBar=function(a){Ad(a,"bar"),De()},Re.toScatter=function(a){Ad(a,"scatter"),De()},Re.toArea=function(a){Ad(a,"area"),De()},Re.toAreaSpline=function(a){Ad(a,"area-spline"),De()},Re.toPie=function(a){Ad(a,"pie"),De({withTransform:!0})},Re.toDonut=function(a){Ad(a,"donut"),De({withTransform:!0})},Re.groups=function(a){return c(a)?Sf:(Sf=a,ye(),Sf)},Re.xgrids=function(a){return a?(Vg=a,ye(),Vg):Vg},Re.xgrids.add=function(a){return a?Re.xgrids(Vg.concat(a)):void 0},Re.xgrids.remove=function(a){var b=Pe(a);return Re.xgrids(Vg.filter(b))},Re.ygrids=function(a){return a?(Xg=a,ye(),Xg):Xg},Re.ygrids.add=function(a){return a?Re.ygrids(Xg.concat(a)):void 0},Re.ygrids.remove=function(a){var b=Pe(a);return Re.ygrids(Xg.filter(b))},Re.regions=function(a){return c(a)?qh:(qh=a,ye(),qh)},Re.regions.add=function(a){return c(a)?qh:(qh=qh.concat(a),ye(),qh)},Re.regions.remove=function(a,c){var e=[].concat(a);return c=d(c)?c:{},e.forEach(function(a){var d=b(c.duration)?c.duration:0;di.selectAll("."+a).transition().duration(d).style("fill-opacity",0).remove(),qh=qh.filter(function(b){return b.classes.indexOf(a)<0})}),qh},Re.data.get=function(a){var b=Re.data.getAsTarget(a);return d(b)?b.values.map(function(a){return a.value}):void 0},Re.data.getAsTarget=function(a){var b=wc(function(b){return b.id===a});return b.length>0?b[0]:void 0},Re.data.names=function(a){return arguments.length?(Object.keys(a).forEach(function(b){Rf[b]=a[b]}),Me(Re.data.targets,{withTransition:!0}),Rf):Rf},Re.x=function(a){return arguments.length&&(jc(Re.data.targets,a),ye({withUpdateOrgXDomain:!0,withUpdateXDomain:!0})),Re.data.x},Re.xs=function(a){return arguments.length&&(kc(Re.data.targets,a),ye({withUpdateOrgXDomain:!0,withUpdateXDomain:!0})),Re.data.x},Re.axis.labels=function(a){arguments.length&&(Object.keys(a).forEach(function(b){bb(b,a[b])}),ye({withY:!1,withSubchart:!1,withTransition:!1}))},Re.resize=function(a){Ue=a?a.width:null,Ve=a?a.height:null,De({withLegend:!0,withTransition:!1})},Re.destroy=function(){Re.data.targets=void 0,Re.data.x={},ji.html(""),a.onresize=null},"url"in e.data)Qe.csv(e.data.url,function(a,b){re(b)});else if("rows"in e.data)re(mc(e.data.rows));else{if(!("columns"in e.data))throw Error("url or rows or columns is required.");re(nc(e.data.columns))}return Re},"function"==typeof a.define&&a.define.amd?a.define("c3",["d3"],e):a.c3=e}(window); \ No newline at end of file diff --git a/package.json b/package.json index beb2387..a675bda 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "c3", - "version": "0.1.25", + "version": "0.1.26", "description": "D3-based reusable chart library", "main": "c3.js", "scripts": {