Browse Source

Add arc.title option

pull/34/merge 0.1.9
Masayuki Tanaka 11 years ago
parent
commit
e65b7a6264
  1. 6
      c3.css
  2. 33
      c3.js
  3. 163
      c3.min.js
  4. 4
      htdocs/samples/dount.html

6
c3.css

@ -70,6 +70,12 @@ text {
stroke-width: 2px;
}
/*-- Arc --*/
.chart-arcs-title {
font-size: 1.3em;
}
/*-- Focus --*/
.target.focused path.-line {

33
c3.js

@ -123,7 +123,8 @@
__point_onunselected = getConfig(['point', 'onunselected'], function () {});
// arc
var __arc_label_fomat = getConfig(['arc', 'label', 'format'], function (d, ratio) { return ratio.toFixed(1) + "%"; });
var __arc_label_fomat = getConfig(['arc', 'label', 'format'], function (d, ratio) { return (100 * ratio).toFixed(1) + "%"; }),
__arc_title = getConfig(['arc', 'title'], "");
// region - region to change style
var __regions = getConfig(['regions'], []);
@ -442,9 +443,11 @@
}
return translate;
}
function getArcRatio(d) {
return (d.endAngle - d.startAngle) / (Math.PI * 2);
}
function textForArcLable(d) {
var ratio = 100 * (d.endAngle - d.startAngle) / (Math.PI * 2);
return __arc_label_fomat(d, ratio);
return __arc_label_fomat(d, getArcRatio(d));
}
function expandArc(targetId, withoutFadeOut) {
var target = svg.selectAll('.chart-arc.target' + (targetId ? '-' + targetId : '')),
@ -453,7 +456,12 @@
.transition().duration(50)
.attr("d", svgArcExpanded)
.transition().duration(100)
.attr("d", svgArcExpandedSub);
.attr("d", svgArcExpandedSub)
.each(function (d) {
if (isDountType(d.data)) {
// callback here
}
});
if (!withoutFadeOut) {
noneTargets.style("opacity", 0.3);
}
@ -1069,9 +1077,16 @@
var id = (typeof d === 'string') ? d : d.id;
return __data_types[id] === 'scatter';
}
function isArcType(d) {
function isPieType(d) {
var id = (typeof d === 'string') ? d : d.id;
return __data_types[id] === 'pie' || __data_types[id] === 'dount';
return __data_types[id] === 'pie';
}
function isDountType(d) {
var id = (typeof d === 'string') ? d : d.id;
return __data_types[id] === 'dount';
}
function isArcType(d) {
return isPieType(d) || isDountType(d);
}
/* not used
function lineData(d) {
@ -1581,7 +1596,11 @@
// Define g for arc chart area
main.select(".chart").append("g")
.attr("class", "chart-arcs")
.attr("transform", translate.arc);
.attr("transform", translate.arc)
.append('text')
.attr('class', 'chart-arcs-title')
.style("text-anchor", "middle")
.text(__arc_title);
if (__zoom_enabled) { // TODO: __zoom_privileged here?
// if zoom privileged, insert rect to forefront

163
c3.min.js vendored

@ -1,87 +1,88 @@
(function(O){function ld(){function u(d,f){d.attr("transform",function(d){return"translate("+(f(d)+ba)+", 0)"})}function x(d,f){d.attr("transform",function(d){return"translate(0,"+f(d)+")"})}function O(d){var f=d[0];d=d[d.length-1];return f<d?[f,d]:[d,f]}function Ea(d){for(var f=[],n=Math.ceil(d[0]);n<d[1];n++)f.push(n);0<f.length&&0<f[0]&&f.unshift(f[0]-(f[1]-f[0]));return f}function Fa(d){d=d<ca.length?ca[d]:d;return M?M(d):d}function q(q){q.each(function(){var q=d.select(this),ha=Ea(n.domain()),
(function(O){function md(){function u(d,f){d.attr("transform",function(d){return"translate("+(f(d)+ba)+", 0)"})}function x(d,f){d.attr("transform",function(d){return"translate(0,"+f(d)+")"})}function O(d){var f=d[0];d=d[d.length-1];return f<d?[f,d]:[d,f]}function Ea(d){for(var f=[],n=Math.ceil(d[0]);n<d[1];n++)f.push(n);0<f.length&&0<f[0]&&f.unshift(f[0]-(f[1]-f[0]));return f}function Fa(d){d=d<ca.length?ca[d]:d;return M?M(d):d}function q(q){q.each(function(){var q=d.select(this),ha=Ea(n.domain()),
Q=q.selectAll(".tick.major").data(ha,String),R=Q.enter().insert("g","path").attr("class","tick major").style("opacity",1E-6),S=d.transition(Q.exit()).style("opacity",1E-6).remove(),w=d.transition(Q).style("opacity",1),G,M=n.rangeExtent?n.rangeExtent():O(n.range()),q=q.selectAll(".domain").data([0]);q.enter().append("path").attr("class","domain");var q=d.transition(q),y=n.copy(),ca=this.__chart__||y;this.__chart__=y;R.append("line");R.append("text");var ia=R.select("line"),Wa=w.select("line"),ja=Q.select("text"),
Xa=R.select("text"),Ya=w.select("text");ba=(y(1)-y(0))/2;Q=qa?0:ba;switch(A){case "bottom":G=u;ia.attr("y2",N);Xa.attr("y",Math.max(N,0)+f);Wa.attr("x1",Q).attr("x2",Q).attr("y2",N);Ya.attr("x",0).attr("y",Math.max(N,0)+f);ja.attr("dy",".71em").style("text-anchor","middle");ja.text(function(d){return ha.length<W||0===d%Math.ceil(ha.length/W)?Fa(d):""});q.attr("d","M"+M[0]+","+X+"V0H"+M[1]+"V"+X);break;case "left":G=x,ia.attr("x2",-N),Xa.attr("x",-(Math.max(N,0)+f)),Wa.attr("x2",-N).attr("y2",0),Ya.attr("x",
-(Math.max(N,0)+f)).attr("y",ba),ja.attr("dy",".32em").style("text-anchor","end"),ja.text(function(d){return ha.length<W||0===d%Math.ceil(ha.length/W)?Fa(d):""}),q.attr("d","M"+-X+","+M[0]+"H0V"+M[1]+"H"+-X)}if(n.ticks)R.call(G,ca),w.call(G,y),S.call(G,y);else{var Za=y.rangeBand()/2,S=function(d){return y(d)+Za};R.call(G,S);w.call(G,S)}})}var n=d.scale.linear(),A="bottom",N=6,X=6,f=3,qa=!1,W=10,ba=0,M=null,ca=[];q.scale=function(d){if(!arguments.length)return n;n=d;return q};q.orient=function(d){if(!arguments.length)return A;
A=d in{top:1,right:1,bottom:1,left:1}?d+"":"bottom";return q};q.categories=function(d){if(!arguments.length)return ca;ca=d;return q};q.tickCentered=function(d){if(!arguments.length)return qa;qa=d;return q};q.tickTextNum=function(d){if(!arguments.length)return W;W=d;return q};q.tickFormat=function(d){if(!arguments.length)return M;M=d;return q};q.tickOffset=function(){return ba};q.ticks=function(){};return q}function x(d){return"undefined"===typeof d}function u(d){return"undefined"!==typeof d}var yb=
O.c3={},d=O.d3;yb.generate=function(aa){var ic,jc,Ea,Fa,q,n,A,N,X;function f(a,b){for(var c=aa,e=0;e<a.length;e++){if(!(a[e]in c))return b;c=c[a[e]]}return c}function qa(){zb=null===$a?ba():$a;ra=W();n=0;A=(g?Ab+mc:0)+(ab?ab:bb?1:40);N=20+(g?0:Ab)+ka;X=cb?cb:Bb?db||g?1:40:20;r=zb-A-X;s=ra-n-N;Ea=g?n:ra-Ab-ka;Fa=g?nc:A;q=20+ka;Cb=g?A-nc-mc:r;eb=g?s:ra-Ea-q;ic=ra-ka;jc=A;Db=s/2;Ga=0.95*Db;Eb=la(h.data.targets,"dount")?0.6*Ga:0}function W(){var a=null===oc?+d.select(sa).style("height").replace("px",
""):oc;return 0<a?a:320}function ba(){return+d.select(sa).style("width").replace("px","")}function M(){return r+2+A+X}function ca(){return 40}function ha(){return A+20}function yb(){return s-n+2}function md(){var a=g?s:r,b=ta(T)/ta(m.domain()),c=fb();return 1<c?a*b/(c-1):a}function Q(){Fb=g?1:0;Gb=g?s:r;Hb=g?0:s;Ib=g?r:1;Jb=g?0:eb;Kb=g?Cb:1;m=R(Fb,Gb,u(m)?m.domain():void 0,function(){return I.tickOffset()});z=S(Hb,Ib,u(z)?z.domain():void 0);Y=S(Hb,Ib,u(Y)?Y.domain():void 0);U=R(Fb,Gb,u(T)?T:void 0,
function(a){return 0===a%1?gb.tickOffset():0});hb=S(Jb,Kb);ib=S(Jb,Kb);I=kc(m,nd);ua=d.svg.axis().scale(z).orient(od);jb=d.svg.axis().scale(Y).orient(pd);gb=kc(U,qd);kb=Wa();pc=ja();qc=ja(0.98)}function R(a,b,c,e){var k=(B?d.time.scale():d.scale.linear()).range([a,b]);k.orgDomain=function(){return k.domain()};u(c)&&k.domain(c);x(e)&&(e=function(){return 0});if(da){var va=k,f,k=function(a){return va(a)+e(a)};for(f in va)k[f]=va[f];k.orgDomain=function(){return va.domain()};k.domain=function(a){if(!arguments.length)return a=
va.domain(),[a[0],a[1]+1];va.domain(a);return k}}return k}function S(a,b){return d.scale.linear().range([a,b])}function w(a){return"y2"===y(a)?Y:z}function G(a){return"y2"===y(a)?ib:hb}function kc(a,b){var c=(da?ld():d.svg.axis()).scale(a).orient(b);c.tickFormat(lc());da?c.categories(Ha).tickCentered(rd):c.tickOffset=function(){return 0};return c}function y(a){return a in rc?rc[a]:"y"}function lc(){var a=B?sd:da?td:function(a){return a};lb&&(a="function"===typeof lb?lb:B?function(a){return d.time.format(lb)(a)}:
O.c3={},d=O.d3;yb.generate=function(aa){var jc,kc,Ea,Fa,q,n,A,N,X;function f(a,b){for(var c=aa,e=0;e<a.length;e++){if(!(a[e]in c))return b;c=c[a[e]]}return c}function qa(){zb=null===$a?ba():$a;ra=W();n=0;A=(g?Ab+nc:0)+(ab?ab:bb?1:40);N=20+(g?0:Ab)+ka;X=cb?cb:Bb?db||g?1:40:20;r=zb-A-X;s=ra-n-N;Ea=g?n:ra-Ab-ka;Fa=g?oc:A;q=20+ka;Cb=g?A-oc-nc:r;eb=g?s:ra-Ea-q;jc=ra-ka;kc=A;Db=s/2;Ga=0.95*Db;Eb=la(h.data.targets,"dount")?0.6*Ga:0}function W(){var a=null===pc?+d.select(sa).style("height").replace("px",
""):pc;return 0<a?a:320}function ba(){return+d.select(sa).style("width").replace("px","")}function M(){return r+2+A+X}function ca(){return 40}function ha(){return A+20}function yb(){return s-n+2}function nd(){var a=g?s:r,b=ta(T)/ta(m.domain()),c=fb();return 1<c?a*b/(c-1):a}function Q(){Fb=g?1:0;Gb=g?s:r;Hb=g?0:s;Ib=g?r:1;Jb=g?0:eb;Kb=g?Cb:1;m=R(Fb,Gb,u(m)?m.domain():void 0,function(){return I.tickOffset()});z=S(Hb,Ib,u(z)?z.domain():void 0);Y=S(Hb,Ib,u(Y)?Y.domain():void 0);U=R(Fb,Gb,u(T)?T:void 0,
function(a){return 0===a%1?gb.tickOffset():0});hb=S(Jb,Kb);ib=S(Jb,Kb);I=lc(m,od);ua=d.svg.axis().scale(z).orient(pd);jb=d.svg.axis().scale(Y).orient(qd);gb=lc(U,rd);kb=Wa();qc=ja();rc=ja(0.98)}function R(a,b,c,e){var k=(B?d.time.scale():d.scale.linear()).range([a,b]);k.orgDomain=function(){return k.domain()};u(c)&&k.domain(c);x(e)&&(e=function(){return 0});if(da){var va=k,f,k=function(a){return va(a)+e(a)};for(f in va)k[f]=va[f];k.orgDomain=function(){return va.domain()};k.domain=function(a){if(!arguments.length)return a=
va.domain(),[a[0],a[1]+1];va.domain(a);return k}}return k}function S(a,b){return d.scale.linear().range([a,b])}function w(a){return"y2"===y(a)?Y:z}function G(a){return"y2"===y(a)?ib:hb}function lc(a,b){var c=(da?md():d.svg.axis()).scale(a).orient(b);c.tickFormat(mc());da?c.categories(Ha).tickCentered(sd):c.tickOffset=function(){return 0};return c}function y(a){return a in sc?sc[a]:"y"}function mc(){var a=B?td:da?ud:function(a){return a};lb&&(a="function"===typeof lb?lb:B?function(a){return d.time.format(lb)(a)}:
a);return a}function ia(a){var b=!1;Lb(h.data.targets).forEach(function(c){b||c.data.id!==a.data.id||(b=!0,a=c)});return b?a:null}function Wa(){var a=d.svg.arc().outerRadius(Ga).innerRadius(Eb),b=function(b,e){var k;return e?a(b):(k=ia(b))?a(k):"M 0 0"};b.centroid=a.centroid;return b}function ja(a){var b=d.svg.arc().outerRadius(Db*(a?a:1)).innerRadius(Eb);return function(a){return(a=ia(a))?b(a):"M 0 0"}}function Xa(a){a=ia(a);var b,c;b="";a&&(b=kb.centroid(a),a=b[0],b=b[1],c=Math.sqrt(a*a+b*b),b=
"translate("+0.8*(a/c)*Ga+","+0.8*(b/c)*Ga+")");return b}function Ya(a){return ud(a,100*(a.endAngle-a.startAngle)/(2*Math.PI))}function Za(a,b){var c=p.selectAll(".chart-arc.target"+(a?"-"+a:"")),e=p.selectAll(".-arc").filter(function(b){return b.data.id!==a});c.selectAll("path").transition().duration(50).attr("d",pc).transition().duration(100).attr("d",qc);b||e.style("opacity",0.3)}function xb(a){p.selectAll(".chart-arc.target"+(a?"-"+a:"")).selectAll("path").transition().duration(50).attr("d",kb);
p.selectAll(".-arc").style("opacity",1)}function vd(a){var b=sc(a),c,e,k,f;if(0<t.length)for(f=tc(a),a=0;a<t.length;a++)for(e=t[a][0],f&&b[e]&&b[e].forEach(function(a,c){b[e][c]=0>a?a:0}),c=1;c<t[a].length;c++)k=t[a][c],b[k]&&b[k].forEach(function(a,c){y(k)!==y(e)||!b[e]||f&&0<+a||(b[e][c]+=+a)});return d.min(Object.keys(b).map(function(a){return d.min(b[a])}))}function wd(a){var b=sc(a),c,e,k,f;if(0<t.length)for(f=xd(a),a=0;a<t.length;a++)for(e=t[a][0],f&&b[e]&&b[e].forEach(function(a,c){b[e][c]=
0<a?a:0}),c=1;c<t[a].length;c++)k=t[a][c],b[k]&&b[k].forEach(function(a,c){y(k)!==y(e)||!b[e]||f&&0>+a||(b[e][c]+=+a)});return d.max(Object.keys(b).map(function(a){return d.max(b[a])}))}function mb(a){var b=nb(function(b){return y(b.id)===a}),c="y2"===a?yd:zd,e="y2"===a?Ad:Bd,c=c?c:vd(b),e=e?e:wd(b),k=0.1*Math.abs(e-c),d=k,f=k,g="y2"===a?Cd:Dd;g&&(c=Math.max(Math.abs(c),Math.abs(e)),e=c-g,c=g-c);"y"===a&&Ia&&(d=Ia.top?Ia.top:k,f=Ia.bottom?Ia.bottom:k);"y2"===a&&Ja&&(d=Ja.top?Ja.top:k,f=Ja.bottom?
Ja.bottom:k);la(b,"bar")&&!tc(b)&&(f=c);return[c-f,e+d]}function Ed(a){return d.min(a,function(a){return d.min(a.values,function(a){return a.x})})}function Fd(a){return d.max(a,function(a){return d.max(a.values,function(a){return a.x})})}function ob(a){var b=[Ed(a),Fd(a)];a=b[0];var b=b[1],c=da?0:0.01*Math.abs(a-b);a=B?new Date(a.getTime()-c):a-c;b=B?new Date(b.getTime()+c):b+c;return[a,b]}function ta(a){return a[1]-a[0]}function Gd(a){for(var b=0;b<a.length;b++)if(!(a[b]in pb))return!1;return!0}
function Hd(a){for(var b=[],c=0;c<a.length;c++)a[c]in pb&&b.push(uc(pb[a[c]]));return b}function Mb(a){return"start"in a?m(B?ma(a.start):a.start):0}function vc(a){var b=Mb(a);a=("end"in a?m(B?ma(a.end):a.end):r)-b;return 0>a?0:a}function wc(a){return na&&a===na||Z&&Id(Z,a)}function Jd(a){return!wc(a)}function Kd(a){Object.keys(a).forEach(function(b){Z[b]=a[b]})}function qb(a){var b;a&&(b=Ka[a.id],a.name=b?b:a.id);return a}function xc(a){var b=a[0],c={},e=[],k,d;for(k=1;k<a.length;k++){c={};for(d=
0;d<a[k].length;d++)c[b[d]]=a[k][d];e.push(c)}return e}function yc(a){var b=[],c,e,k;for(c=0;c<a.length;c++)for(k=a[c][0],e=1;e<a[c].length;e++)x(b[e-1])&&(b[e-1]={}),b[e-1][k]=a[c][e];return b}function La(a){var b=d.keys(a[0]).filter(Jd),c=d.keys(a[0]).filter(wc);if(B&&0===c.length)return O.alert('data.x or data.xs must be specified when axis.x.type == "timeseries"'),[];Nb&&b.forEach(function(b){var k=na?na:Z?Z[b]:null;0<=c.indexOf(k)?h.data.x[b]=a.map(function(a){return a[k]}):h.data.x[b]=h.data.x[Object.keys(h.data.x)[0]]});
b=b.map(function(b){var c=Ld(b);return{id:c,id_org:b,values:a.map(function(a,d){var f;f=na?na:Z?Z[b]:null;f=B?ma(a[f]):Nb?a[f]?a[f]:b in h.data.x&&h.data.x[b]&&h.data.x[b][d]?h.data.x[b][d]:d:d;a.x=f;return{x:f,value:null===a[b]||isNaN(a[b])?null:+a[b],id:c}})}});b.forEach(function(a){var b;a.values=a.values.sort(function(a,b){return(a.x||0===a.x?a.x:Infinity)-(b.x||0===b.x?b.x:Infinity)});b=0;a.values.forEach(function(a){a.index=b++})});zc&&Ma(rb(b).filter(function(a){return!(a in C)}),zc);b.forEach(function(a){pb[a.id_org]=
uc(a)});return b}function uc(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 Ac(a){return 0<a&&h.data.targets[0].values[a-1]?h.data.targets[0].values[a-1].x:void 0}function fb(){return d.max(h.data.targets,function(a){return a.values.length})}function Md(){var a=h.data.targets.length,b=0,c;1<a?h.data.targets.forEach(function(a){a.values.length>b&&(c=a,b=a.values.length)}):c=a?h.data.targets[0]:null;return c}function rb(a){a=x(a)?h.data.targets:
a;return a.map(function(a){return a.id})}function Bc(a){var b=rb(),c;for(c=0;c<b.length;c++)if(b[c]===a)return!0;return!1}function nb(a){return u(a)?h.data.targets.filter(a):h.data.targets}function sc(a){var b={};a.forEach(function(a){b[a.id]=[];a.values.forEach(function(e){b[a.id].push(e.value)})});return b}function Cc(a,b){var c=Object.keys(a),e,k,d;for(e=0;e<c.length;e++)for(d=a[c[e]].values,k=0;k<d.length;k++)if(b(d[k].value))return!0;return!1}function tc(a){return Cc(a,function(a){return 0>a})}
function xd(a){return Cc(a,function(a){return 0<a})}function td(a){return a<Ha.length?Ha[a]:a}function Na(a){return"-shapes -shapes-"+a.id}function Dc(a){return Na(a)+" -line -line-"+a.id}function Nd(a){return Na(a)+" -circles -circles-"+a.id}function Ec(a){return Na(a)+" -bars -bars-"+a.id}function Od(a){return Na(a.data)+" -arc -arc-"+a.data.id}function Pd(a){return Na(a)+" -area -area-"+a.id}function Qd(a,b){return"-shape -shape-"+b+" -circle -circle-"+b}function Fc(a,b){return"-shape -shape-"+
b+" -bar -bar-"+b}function Rd(a,b){return"region region-"+b+" "+("classes"in a?[].concat(a.classes).join(" "):"")}function Gc(a,b){return"event-rect event-rect-"+b}function Sd(a){return a.value?Hc(a)?0.5:1:0}function wa(a){return m(a.x)}function Oa(a){return m(B?ma(a.value):a.value)}function Pa(a){return z(a.value)}function Ic(a){return U(a.x)}function Jc(a,b){var c,e=a[b].x,k=[];for(c=b-1;0<=c&&e===a[c].x;c--)k.push(a[c]);for(c=b;c<a.length&&e===a[c].x;c++)k.push(a[c]);return k}function Kc(a,b,c,
e){c=c?c:0;e=e?e:a.length-1;var k=Math.floor((e-c)/2)+c;0<m(a[k].x)-b[0]?e=k:c=k;return 1===e-c?(k=[],a[c].x&&(k=k.concat(Jc(a,c))),a[e].x&&(k=k.concat(Jc(a,e))),Lc(k,b)):Kc(a,b,c,e)}function Mc(a,b){var c;c=a.map(function(a){return Kc(a.values,b)});return Lc(c,b)}function Lc(a,b){var c,e;a.forEach(function(a){var d=Ob(a,b);if(d<c||!c)c=d,e=a});return e}function Nc(a,b){var c,e,k,d,f;0!==a.filter(function(a){return a&&a.value}).length&&(V.html(Oc(a)).style("visibility","hidden").style("display","block"),
c=V.property("offsetWidth"),e=V.property("offsetHeight"),g?d=b[0]:(k=p.property("offsetLeft"),d=k+(ab?ab:bb?1:40)+m(a[0].x)+20,f=d+c,k=k+(null===$a?ba():$a)-(cb?cb:Bb?db||g?1:40:20),f>k&&(d-=c+30)),c=b[1]+15+e<W()?b[1]+15:b[1]-e,V.style("top",c+"px").style("left",d+"px").style("visibility","visible"))}function Pc(a){la(h.data.targets,"scatter")||D(h.data.targets)||l.selectAll("line.xgrid-focus").style("visibility","visible").data([a]).attr(g?"y1":"x1",wa).attr(g?"y2":"x2",wa)}function Qc(){l.select("line.xgrid-focus").style("visibility",
"hidden")}function xa(a){return a.x||0===a.x?m(a.x):null}function ya(a){return w(a.id)(a.value)}function Td(){var a={},b=0,c,e;nb(sb).forEach(function(k){for(c=0;c<t.length;c++)if(!(0>t[c].indexOf(k.id)))for(e=0;e<t[c].length;e++)if(t[c][e]in a){a[k.id]=a[t[c][e]];break}x(a[k.id])&&(a[k.id]=b++)});a.__max__=b-1;return a}function Ud(a,b,c,e){var k=e?U:m;return b?function(e){var d=e.id in c?c[e.id]:0;return e.x||0===e.x?k(e.x)-a*(b/2-d):0}:function(){return 0}}function Vd(a){return function(b){return(a?
G(b.id):w(b.id))(b.value)}}function Wd(a,b){var c=Object.keys(a);return function(e,k){var d=b?G(e.id):w(e.id),f=d(0),g=f;nb(sb).forEach(function(b){b.id!==e.id&&a[b.id]===a[e.id]&&c.indexOf(b.id)<c.indexOf(e.id)&&0<b.values[k].value*e.value&&(g+=d(b.values[k].value)-f)});return g}}function Ma(a,b){var c=x(a)?rb():a;"string"===typeof c&&(c=[c]);for(var e=0;e<c.length;e++)C[c[e]]=b}function la(a,b){var c=!1;a.forEach(function(a){C[a.id]===b&&(c=!0);a.id in C||"line"!==b||(c=!0)});return c}function D(a){return la(a,
"pie")||la(a,"dount")}function Pb(a){a="string"===typeof a?a:a.id;return!(a in C)||"line"===C[a]||"spline"===C[a]||"area"===C[a]||"area-spline"===C[a]}function Rc(a){a="string"===typeof a?a:a.id;return"spline"===C[a]||"area-spline"===C[a]}function sb(a){return"bar"===C["string"===typeof a?a:a.id]}function Hc(a){return"scatter"===C["string"===typeof a?a:a.id]}function Sc(a){a="string"===typeof a?a:a.id;return"pie"===C[a]||"dount"===C[a]}function Tc(a){return sb(a)?a.values:[]}function Xd(a){return Pb(a)||
Hc(a)?a.values:[]}function ma(a){var b;if(!a)throw Error(a+" can not be parsed as d3.time with format "+Qb+". Maybe 'x' of this data is not defined. See data.x or data.xs option.");b=d.time.format(Qb).parse(a);if(!b)throw Error("Failed to parse '"+a+"' with format "+Qb);return b}function Uc(a,b){var c=d.mouse(a),e=d.select(a),k=1*e.attr("cx"),e=1*e.attr("cy");return Math.sqrt(Math.pow(k-c[0],2)+Math.pow(e-c[1],2))<b}function Vc(a){var b=d.mouse(a),c=d.select(a);a=1*c.attr("x");var e=1*c.attr("y"),
c=1*c.attr("width");return a-10<b[0]&&b[0]<a+c+10&&e-10<b[1]}function Yd(a,b){var c;for(c=0;c<b.length;c++)if(b[c].start<a&&a<=b[c].end)return!0;return!1}function Id(a,b){var c=!1;Object.keys(a).forEach(function(e){a[e]===b&&(c=!0)});return c}function Ob(a,b){return Math.pow(m(a.x)-b[0],2)+Math.pow(z(a.value)-b[1],2)}function Wc(a,b,c){Zd(a,b);l.select(".selected-circles-"+b.id).selectAll(".selected-circle-"+c).data([b]).enter().append("circle").attr("class",function(){return"selected-circle selected-circle-"+
c}).attr("cx",g?ya:xa).attr("cy",g?xa:ya).attr("stroke",function(){return J(b.id)}).attr("r",1.4*Qa).transition().duration(100).attr("r",Qa)}function Rb(a,b,c){$d(a,b);l.select(".selected-circles-"+b.id).selectAll(".selected-circle-"+c).transition().duration(100).attr("r",0).remove()}function Xc(a,b,c,e){a?Wc(b,c,e):Rb(b,c,e)}function ae(){}function Yc(){}function Zc(a,b,c,e){}function Sb(a){return a.filter(function(a){return null!==a.value})}function Tb(a,b){return(b?l.selectAll(".-circles-"+b):
l).selectAll(".-circle"+(a||0===a?"-"+a:""))}function Ub(a){Tb(a).filter(function(){return d.select(this).classed($)}).classed($,!1).attr("r",Vb)}function $c(a){return l.selectAll(".-bar"+(a||0===a?"-"+a:""))}function be(a,b,c,e){var d,f,h="M",l,m,za,p,q,n=[];if(u(e))for(d=0;d<e.length;d++)n[d]={},x(e[d].start)?n[d].start=a[0].x:n[d].start=B?ma(e[d].start):e[d].start,x(e[d].end)?n[d].end=a[a.length-1].x:n[d].end=B?ma(e[d].end):e[d].end;p=g?function(a){return c(a.value)}:function(a){return b(a.x)};
q=g?function(a){return b(a.x)}:function(a){return c(a.value)};e=B?function(a,e,d,f){var k=a.x.getTime();a=e.x-a.x;e=new Date(k+a*(d+f));return"M"+b(new Date(k+a*d))+" "+c(m(d))+" "+b(e)+" "+c(m(d+f))}:function(a,e,d,f){return"M"+b(l(d))+" "+c(m(d))+" "+b(l(d+f))+" "+c(m(d+f))};for(d=0;d<a.length;d++)if(x(n)||!Yd(a[d].x,n))h+=" "+p(a[d])+" "+q(a[d]);else{l=R(a[d-1].x,a[d].x);m=S(a[d-1].value,a[d].value);f=b(a[d].x)-b(a[d-1].x);za=c(a[d].value)-c(a[d-1].value);f=Math.sqrt(Math.pow(f,2)+Math.pow(za,
2));za=2/f;var r=2*za;for(f=za;1>=f;f+=r)h+=e(a[d-1],a[d],f,za)}return h}function Wb(a){var b;tb=d.select(sa);if(tb.empty())O.alert('No bind element found. Check the selector specified by "bindto" and existance of that element. Default "bindto" is "#chart".');else{tb.html("");h.data.x={};h.data.targets=La(a);qa();Q();m.domain(d.extent(ob(h.data.targets)));z.domain(mb("y"));Y.domain(mb("y2"));U.domain(m.domain());hb.domain(z.domain());ib.domain(Y.domain());I.ticks(10>a.length?a.length:10);ua.ticks(ce).outerTickSize(0).tickFormat(de);
jb.ticks(ee).outerTickSize(0).tickFormat(fe);T=m.domain();K.scale(U);oa&&E.scale(m);p=d.select(sa).append("svg").attr("width",r+A+X).attr("height",s+n+N).on("mouseenter",ge).on("mouseleave",he);ub=p.append("defs");ub.append("clipPath").attr("id",Xb).append("rect").attr("y",n).attr("width",r).attr("height",s-n);ub.append("clipPath").attr("id","xaxis-clip").append("rect").attr("x",-1-A).attr("y",-20).attr("width",M).attr("height",ca);ub.append("clipPath").attr("id","yaxis-clip").append("rect").attr("x",
"translate("+0.8*(a/c)*Ga+","+0.8*(b/c)*Ga+")");return b}function Ya(a){return vd(a,(a.endAngle-a.startAngle)/(2*Math.PI))}function Za(a,b){var c=p.selectAll(".chart-arc.target"+(a?"-"+a:"")),e=p.selectAll(".-arc").filter(function(b){return b.data.id!==a});c.selectAll("path").transition().duration(50).attr("d",qc).transition().duration(100).attr("d",rc).each(function(a){Mb(a.data)});b||e.style("opacity",0.3)}function xb(a){p.selectAll(".chart-arc.target"+(a?"-"+a:"")).selectAll("path").transition().duration(50).attr("d",
kb);p.selectAll(".-arc").style("opacity",1)}function wd(a){var b=tc(a),c,e,k,f;if(0<t.length)for(f=uc(a),a=0;a<t.length;a++)for(e=t[a][0],f&&b[e]&&b[e].forEach(function(a,c){b[e][c]=0>a?a:0}),c=1;c<t[a].length;c++)k=t[a][c],b[k]&&b[k].forEach(function(a,c){y(k)!==y(e)||!b[e]||f&&0<+a||(b[e][c]+=+a)});return d.min(Object.keys(b).map(function(a){return d.min(b[a])}))}function xd(a){var b=tc(a),c,e,k,f;if(0<t.length)for(f=yd(a),a=0;a<t.length;a++)for(e=t[a][0],f&&b[e]&&b[e].forEach(function(a,c){b[e][c]=
0<a?a:0}),c=1;c<t[a].length;c++)k=t[a][c],b[k]&&b[k].forEach(function(a,c){y(k)!==y(e)||!b[e]||f&&0>+a||(b[e][c]+=+a)});return d.max(Object.keys(b).map(function(a){return d.max(b[a])}))}function mb(a){var b=nb(function(b){return y(b.id)===a}),c="y2"===a?zd:Ad,e="y2"===a?Bd:Cd,c=c?c:wd(b),e=e?e:xd(b),k=0.1*Math.abs(e-c),d=k,f=k,g="y2"===a?Dd:Ed;g&&(c=Math.max(Math.abs(c),Math.abs(e)),e=c-g,c=g-c);"y"===a&&Ia&&(d=Ia.top?Ia.top:k,f=Ia.bottom?Ia.bottom:k);"y2"===a&&Ja&&(d=Ja.top?Ja.top:k,f=Ja.bottom?
Ja.bottom:k);la(b,"bar")&&!uc(b)&&(f=c);return[c-f,e+d]}function Fd(a){return d.min(a,function(a){return d.min(a.values,function(a){return a.x})})}function Gd(a){return d.max(a,function(a){return d.max(a.values,function(a){return a.x})})}function ob(a){var b=[Fd(a),Gd(a)];a=b[0];var b=b[1],c=da?0:0.01*Math.abs(a-b);a=B?new Date(a.getTime()-c):a-c;b=B?new Date(b.getTime()+c):b+c;return[a,b]}function ta(a){return a[1]-a[0]}function Hd(a){for(var b=0;b<a.length;b++)if(!(a[b]in pb))return!1;return!0}
function Id(a){for(var b=[],c=0;c<a.length;c++)a[c]in pb&&b.push(vc(pb[a[c]]));return b}function Nb(a){return"start"in a?m(B?ma(a.start):a.start):0}function wc(a){var b=Nb(a);a=("end"in a?m(B?ma(a.end):a.end):r)-b;return 0>a?0:a}function xc(a){return na&&a===na||Z&&Jd(Z,a)}function Kd(a){return!xc(a)}function Ld(a){Object.keys(a).forEach(function(b){Z[b]=a[b]})}function qb(a){var b;a&&(b=Ka[a.id],a.name=b?b:a.id);return a}function yc(a){var b=a[0],c={},e=[],k,d;for(k=1;k<a.length;k++){c={};for(d=
0;d<a[k].length;d++)c[b[d]]=a[k][d];e.push(c)}return e}function zc(a){var b=[],c,e,k;for(c=0;c<a.length;c++)for(k=a[c][0],e=1;e<a[c].length;e++)x(b[e-1])&&(b[e-1]={}),b[e-1][k]=a[c][e];return b}function La(a){var b=d.keys(a[0]).filter(Kd),c=d.keys(a[0]).filter(xc);if(B&&0===c.length)return O.alert('data.x or data.xs must be specified when axis.x.type == "timeseries"'),[];Ob&&b.forEach(function(b){var k=na?na:Z?Z[b]:null;0<=c.indexOf(k)?h.data.x[b]=a.map(function(a){return a[k]}):h.data.x[b]=h.data.x[Object.keys(h.data.x)[0]]});
b=b.map(function(b){var c=Md(b);return{id:c,id_org:b,values:a.map(function(a,d){var f;f=na?na:Z?Z[b]:null;f=B?ma(a[f]):Ob?a[f]?a[f]:b in h.data.x&&h.data.x[b]&&h.data.x[b][d]?h.data.x[b][d]:d:d;a.x=f;return{x:f,value:null===a[b]||isNaN(a[b])?null:+a[b],id:c}})}});b.forEach(function(a){var b;a.values=a.values.sort(function(a,b){return(a.x||0===a.x?a.x:Infinity)-(b.x||0===b.x?b.x:Infinity)});b=0;a.values.forEach(function(a){a.index=b++})});Ac&&Ma(rb(b).filter(function(a){return!(a in C)}),Ac);b.forEach(function(a){pb[a.id_org]=
vc(a)});return b}function vc(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 Bc(a){return 0<a&&h.data.targets[0].values[a-1]?h.data.targets[0].values[a-1].x:void 0}function fb(){return d.max(h.data.targets,function(a){return a.values.length})}function Nd(){var a=h.data.targets.length,b=0,c;1<a?h.data.targets.forEach(function(a){a.values.length>b&&(c=a,b=a.values.length)}):c=a?h.data.targets[0]:null;return c}function rb(a){a=x(a)?h.data.targets:
a;return a.map(function(a){return a.id})}function Cc(a){var b=rb(),c;for(c=0;c<b.length;c++)if(b[c]===a)return!0;return!1}function nb(a){return u(a)?h.data.targets.filter(a):h.data.targets}function tc(a){var b={};a.forEach(function(a){b[a.id]=[];a.values.forEach(function(e){b[a.id].push(e.value)})});return b}function Dc(a,b){var c=Object.keys(a),e,k,d;for(e=0;e<c.length;e++)for(d=a[c[e]].values,k=0;k<d.length;k++)if(b(d[k].value))return!0;return!1}function uc(a){return Dc(a,function(a){return 0>a})}
function yd(a){return Dc(a,function(a){return 0<a})}function ud(a){return a<Ha.length?Ha[a]:a}function Na(a){return"-shapes -shapes-"+a.id}function Ec(a){return Na(a)+" -line -line-"+a.id}function Od(a){return Na(a)+" -circles -circles-"+a.id}function Fc(a){return Na(a)+" -bars -bars-"+a.id}function Pd(a){return Na(a.data)+" -arc -arc-"+a.data.id}function Qd(a){return Na(a)+" -area -area-"+a.id}function Rd(a,b){return"-shape -shape-"+b+" -circle -circle-"+b}function Gc(a,b){return"-shape -shape-"+
b+" -bar -bar-"+b}function Sd(a,b){return"region region-"+b+" "+("classes"in a?[].concat(a.classes).join(" "):"")}function Hc(a,b){return"event-rect event-rect-"+b}function Td(a){return a.value?Ic(a)?0.5:1:0}function wa(a){return m(a.x)}function Oa(a){return m(B?ma(a.value):a.value)}function Pa(a){return z(a.value)}function Jc(a){return U(a.x)}function Kc(a,b){var c,e=a[b].x,k=[];for(c=b-1;0<=c&&e===a[c].x;c--)k.push(a[c]);for(c=b;c<a.length&&e===a[c].x;c++)k.push(a[c]);return k}function Lc(a,b,c,
e){c=c?c:0;e=e?e:a.length-1;var k=Math.floor((e-c)/2)+c;0<m(a[k].x)-b[0]?e=k:c=k;return 1===e-c?(k=[],a[c].x&&(k=k.concat(Kc(a,c))),a[e].x&&(k=k.concat(Kc(a,e))),Mc(k,b)):Lc(a,b,c,e)}function Nc(a,b){var c;c=a.map(function(a){return Lc(a.values,b)});return Mc(c,b)}function Mc(a,b){var c,e;a.forEach(function(a){var d=Pb(a,b);if(d<c||!c)c=d,e=a});return e}function Oc(a,b){var c,e,k,d,f;0!==a.filter(function(a){return a&&a.value}).length&&(V.html(Pc(a)).style("visibility","hidden").style("display","block"),
c=V.property("offsetWidth"),e=V.property("offsetHeight"),g?d=b[0]:(k=p.property("offsetLeft"),d=k+(ab?ab:bb?1:40)+m(a[0].x)+20,f=d+c,k=k+(null===$a?ba():$a)-(cb?cb:Bb?db||g?1:40:20),f>k&&(d-=c+30)),c=b[1]+15+e<W()?b[1]+15:b[1]-e,V.style("top",c+"px").style("left",d+"px").style("visibility","visible"))}function Qc(a){la(h.data.targets,"scatter")||D(h.data.targets)||l.selectAll("line.xgrid-focus").style("visibility","visible").data([a]).attr(g?"y1":"x1",wa).attr(g?"y2":"x2",wa)}function Rc(){l.select("line.xgrid-focus").style("visibility",
"hidden")}function xa(a){return a.x||0===a.x?m(a.x):null}function ya(a){return w(a.id)(a.value)}function Ud(){var a={},b=0,c,e;nb(sb).forEach(function(k){for(c=0;c<t.length;c++)if(!(0>t[c].indexOf(k.id)))for(e=0;e<t[c].length;e++)if(t[c][e]in a){a[k.id]=a[t[c][e]];break}x(a[k.id])&&(a[k.id]=b++)});a.__max__=b-1;return a}function Vd(a,b,c,e){var k=e?U:m;return b?function(e){var d=e.id in c?c[e.id]:0;return e.x||0===e.x?k(e.x)-a*(b/2-d):0}:function(){return 0}}function Wd(a){return function(b){return(a?
G(b.id):w(b.id))(b.value)}}function Xd(a,b){var c=Object.keys(a);return function(e,k){var d=b?G(e.id):w(e.id),f=d(0),g=f;nb(sb).forEach(function(b){b.id!==e.id&&a[b.id]===a[e.id]&&c.indexOf(b.id)<c.indexOf(e.id)&&0<b.values[k].value*e.value&&(g+=d(b.values[k].value)-f)});return g}}function Ma(a,b){var c=x(a)?rb():a;"string"===typeof c&&(c=[c]);for(var e=0;e<c.length;e++)C[c[e]]=b}function la(a,b){var c=!1;a.forEach(function(a){C[a.id]===b&&(c=!0);a.id in C||"line"!==b||(c=!0)});return c}function D(a){return la(a,
"pie")||la(a,"dount")}function Qb(a){a="string"===typeof a?a:a.id;return!(a in C)||"line"===C[a]||"spline"===C[a]||"area"===C[a]||"area-spline"===C[a]}function Sc(a){a="string"===typeof a?a:a.id;return"spline"===C[a]||"area-spline"===C[a]}function sb(a){return"bar"===C["string"===typeof a?a:a.id]}function Ic(a){return"scatter"===C["string"===typeof a?a:a.id]}function Tc(a){return"pie"===C["string"===typeof a?a:a.id]}function Mb(a){return"dount"===C["string"===typeof a?a:a.id]}function Uc(a){return sb(a)?
a.values:[]}function Yd(a){return Qb(a)||Ic(a)?a.values:[]}function ma(a){var b;if(!a)throw Error(a+" can not be parsed as d3.time with format "+Rb+". Maybe 'x' of this data is not defined. See data.x or data.xs option.");b=d.time.format(Rb).parse(a);if(!b)throw Error("Failed to parse '"+a+"' with format "+Rb);return b}function Vc(a,b){var c=d.mouse(a),e=d.select(a),k=1*e.attr("cx"),e=1*e.attr("cy");return Math.sqrt(Math.pow(k-c[0],2)+Math.pow(e-c[1],2))<b}function Wc(a){var b=d.mouse(a),c=d.select(a);
a=1*c.attr("x");var e=1*c.attr("y"),c=1*c.attr("width");return a-10<b[0]&&b[0]<a+c+10&&e-10<b[1]}function Zd(a,b){var c;for(c=0;c<b.length;c++)if(b[c].start<a&&a<=b[c].end)return!0;return!1}function Jd(a,b){var c=!1;Object.keys(a).forEach(function(e){a[e]===b&&(c=!0)});return c}function Pb(a,b){return Math.pow(m(a.x)-b[0],2)+Math.pow(z(a.value)-b[1],2)}function Xc(a,b,c){$d(a,b);l.select(".selected-circles-"+b.id).selectAll(".selected-circle-"+c).data([b]).enter().append("circle").attr("class",function(){return"selected-circle selected-circle-"+
c}).attr("cx",g?ya:xa).attr("cy",g?xa:ya).attr("stroke",function(){return J(b.id)}).attr("r",1.4*Qa).transition().duration(100).attr("r",Qa)}function Sb(a,b,c){ae(a,b);l.select(".selected-circles-"+b.id).selectAll(".selected-circle-"+c).transition().duration(100).attr("r",0).remove()}function Yc(a,b,c,e){a?Xc(b,c,e):Sb(b,c,e)}function be(){}function Zc(){}function $c(a,b,c,e){}function Tb(a){return a.filter(function(a){return null!==a.value})}function Ub(a,b){return(b?l.selectAll(".-circles-"+b):
l).selectAll(".-circle"+(a||0===a?"-"+a:""))}function Vb(a){Ub(a).filter(function(){return d.select(this).classed($)}).classed($,!1).attr("r",Wb)}function ad(a){return l.selectAll(".-bar"+(a||0===a?"-"+a:""))}function ce(a,b,c,e){var d,f,h="M",l,m,za,p,q,n=[];if(u(e))for(d=0;d<e.length;d++)n[d]={},x(e[d].start)?n[d].start=a[0].x:n[d].start=B?ma(e[d].start):e[d].start,x(e[d].end)?n[d].end=a[a.length-1].x:n[d].end=B?ma(e[d].end):e[d].end;p=g?function(a){return c(a.value)}:function(a){return b(a.x)};
q=g?function(a){return b(a.x)}:function(a){return c(a.value)};e=B?function(a,e,d,f){var k=a.x.getTime();a=e.x-a.x;e=new Date(k+a*(d+f));return"M"+b(new Date(k+a*d))+" "+c(m(d))+" "+b(e)+" "+c(m(d+f))}:function(a,e,d,f){return"M"+b(l(d))+" "+c(m(d))+" "+b(l(d+f))+" "+c(m(d+f))};for(d=0;d<a.length;d++)if(x(n)||!Zd(a[d].x,n))h+=" "+p(a[d])+" "+q(a[d]);else{l=R(a[d-1].x,a[d].x);m=S(a[d-1].value,a[d].value);f=b(a[d].x)-b(a[d-1].x);za=c(a[d].value)-c(a[d-1].value);f=Math.sqrt(Math.pow(f,2)+Math.pow(za,
2));za=2/f;var r=2*za;for(f=za;1>=f;f+=r)h+=e(a[d-1],a[d],f,za)}return h}function Xb(a){var b;tb=d.select(sa);if(tb.empty())O.alert('No bind element found. Check the selector specified by "bindto" and existance of that element. Default "bindto" is "#chart".');else{tb.html("");h.data.x={};h.data.targets=La(a);qa();Q();m.domain(d.extent(ob(h.data.targets)));z.domain(mb("y"));Y.domain(mb("y2"));U.domain(m.domain());hb.domain(z.domain());ib.domain(Y.domain());I.ticks(10>a.length?a.length:10);ua.ticks(de).outerTickSize(0).tickFormat(ee);
jb.ticks(fe).outerTickSize(0).tickFormat(ge);T=m.domain();K.scale(U);oa&&E.scale(m);p=d.select(sa).append("svg").attr("width",r+A+X).attr("height",s+n+N).on("mouseenter",he).on("mouseleave",ie);ub=p.append("defs");ub.append("clipPath").attr("id",Yb).append("rect").attr("y",n).attr("width",r).attr("height",s-n);ub.append("clipPath").attr("id","xaxis-clip").append("rect").attr("x",-1-A).attr("y",-20).attr("width",M).attr("height",ca);ub.append("clipPath").attr("id","yaxis-clip").append("rect").attr("x",
-A+1).attr("y",n-1).attr("width",ha).attr("height",yb);l=p.append("g").attr("transform",L.main);F=Aa?p.append("g").attr("transform",L.context):null;Ba=Ca?p.append("g").attr("transform",L.legend):null;V=d.select(sa).style("position","relative").append("div").style("position","absolute").style("z-index","10").style("display","none");l.append("g").attr("class","x axis").attr("clip-path",g?"":"url(#xaxis-clip)").attr("transform",L.x).call(g?ua:I).append("text").attr("class","-axis-x-label").attr("x",
r).attr("dy","-.5em").style("text-anchor","end").text(ie);l.append("g").attr("class","y axis").attr("clip-path",g?"url(#yaxis-clip)":"").call(g?I:ua).append("text").attr("transform","rotate(-90)").attr("dy","1.2em").attr("dx","-.5em").style("text-anchor","end").text(je);Bb&&l.append("g").attr("class","y2 axis").attr("transform",L.y2).call(jb);a=l.append("g").attr("clip-path",Ra).attr("class","grid");ad&&a.append("g").attr("class","xgrids");Yb&&(b=a.append("g").attr("class","xgrid-lines").selectAll(".xgrid-line").data(Yb).enter().append("g").attr("class",
"xgrid-line"),b.append("line").attr("class",function(a){return""+a["class"]}),b.append("text").attr("class",function(a){return""+a["class"]}).attr("text-anchor","end").attr("transform",g?"":"rotate(-90)").attr("dx",g?0:-n).attr("dy",-5).text(function(a){return a.text}));ke&&a.append("g").attr("class","xgrid-focus").append("line").attr("class","xgrid-focus").attr("x1",g?0:-10).attr("x2",g?r:-10).attr("y1",g?-10:n).attr("y2",g?-10:s);bd&&a.append("g").attr("class","ygrids");Zb&&(a=a.append("g").attr("class",
"ygrid-lines").selectAll("ygrid-line").data(Zb).enter().append("g").attr("class","ygrid-line"),a.append("line").attr("class",function(a){return""+a["class"]}),a.append("text").attr("class",function(a){return""+a["class"]}).attr("text-anchor","end").attr("transform",g?"rotate(-90)":"").attr("dx",g?0:-n).attr("dy",-5).text(function(a){return a.text}));l.append("g").attr("clip-path",Ra).attr("class","regions");l.append("g").attr("clip-path",Ra).attr("class","chart");l.select(".chart").append("g").attr("class",
"event-rects").style("fill-opacity",0).style("cursor",oa?"ew-resize":null);l.select(".chart").append("g").attr("class","chart-bars");l.select(".chart").append("g").attr("class","chart-lines");l.select(".chart").append("g").attr("class","chart-arcs").attr("transform",L.arc);if(oa)l.insert("rect",le?null:"g.grid").attr("class","zoom-rect").attr("width",r).attr("height",s).style("opacity",0).style("cursor","ew-resize").call(E).on("dblclick.zoom",null);null!==vb&&K.extent("function"!==typeof vb?vb:vb(ob()));
Aa&&(F.append("g").attr("clip-path",Ra).attr("class","chart"),F.select(".chart").append("g").attr("class","chart-bars"),F.select(".chart").append("g").attr("class","chart-lines"),F.append("g").attr("clip-path",Ra).attr("class","x brush").call(K).selectAll("rect").attr(g?"width":"height",g?Cb:eb),F.append("g").attr("class","x axis").attr("transform",L.subx).attr("clip-path",g?"url(#yaxis-clip)":"").call(gb));Ca&&wb(h.data.targets);cd(h.data.targets);H({withTransition:!1,withUpdateXDomain:!0});if(me){if(B&&
"string"===typeof Da){Da=ma(Da);for(a=0;a<h.data.targets[0].values.length&&0!==h.data.targets[0].values[a].x-Da;a++);Da=a}V.html(Oc(h.data.targets.map(function(a){return qb(a.values[Da])})));V.style("top",dd.top).style("left",dd.left).style("display","block")}null==O.onresize&&(O.onresize=ne());O.onresize.add&&O.onresize.add(oe)}}function pe(a){a.append("rect").attr("class",Gc).style("cursor",ea&&pa?"pointer":null).on("mouseover",function(a,c){if(!Sa&&!D(h.data.targets)){var e=h.data.targets.map(function(a){return qb(a.values[c])}),
d,f;if(0<Object.keys(Ka).length){f=[];for(var g in Ka)for(d=0;d<e.length;d++)if(e[d].id===g){f.push(e[d]);e.shift(d);break}e=f.concat(e)}$b&&Tb(c,void 0).classed($,!0).attr("r",ac);$c(c).classed($,!1);Pc(e[0])}}).on("mouseout",function(a,c){D(h.data.targets)||(Qc(),V.style("display","none"),Ub(c),$c(void 0).classed($,!1))}).on("mousemove",function(a,c){var e;Sa||D(h.data.targets)||(e=h.data.targets.map(function(a){return qb(a.values[c])}),Nc(e,d.mouse(this)),ea&&(pa||l.selectAll(".-shape-"+c).filter(function(a){return fa(a)}).each(function(){var a=
d.select(this).classed($,!0);"circle"===this.nodeName&&a.attr("r",ac);p.select(".event-rect-"+c).style("cursor",null)}).filter(function(){var a=d.select(this);if("circle"===this.nodeName)return Uc(this,Qa);if("rect"===this.nodeName)return Vc(this,a.attr("x"),a.attr("y"))}).each(function(){var a=d.select(this);a.classed($)||(a.classed($,!0),"circle"===this.nodeName&&a.attr("r",Qa));p.select(".event-rect-"+c).style("cursor","pointer")})))}).on("click",function(a,c){D(h.data.targets)||(bc?bc=!1:l.selectAll(".-shape-"+
c).each(function(a){ed(this,a,c)}))}).call(d.behavior.drag().origin(Object).on("drag",function(){fd(d.mouse(this))}).on("dragstart",function(){gd(d.mouse(this))}).on("dragend",function(){hd()})).call(E).on("dblclick.zoom",null)}function qe(a){a.append("rect").attr("x",0).attr("y",0).attr("width",r).attr("height",s).attr("class","event-rect").on("mouseout",function(){D(h.data.targets)||(Qc(),V.style("display","none"),Ub())}).on("mousemove",function(){var a,c,e;Sa||D(h.data.targets)||(a=d.mouse(this),
c=Mc(h.data.targets,a),e=[qb(c)],Nc(e,a),$b&&(Ub(),Tb(c.index,c.id).classed($,!0).attr("r",ac)),Pc(e[0]),100>Ob(c,a)?p.select(".event-rect").style("cursor","pointer"):p.select(".event-rect").style("cursor",null))}).on("click",function(){var a,c;D(h.data.targets)||(a=d.mouse(this),c=Mc(h.data.targets,a),100>Ob(c,a)&&l.select(".-circles-"+c.id).select(".-circle-"+c.index).each(function(){ed(this,c,c.index)}))}).call(d.behavior.drag().origin(Object).on("drag",function(){fd(d.mouse(this))}).on("dragstart",
function(){gd(d.mouse(this))}).on("dragend",function(){hd()})).call(E).on("dblclick.zoom",null)}function ed(a,b,c){var e=d.select(a),f=e.classed(ga),g=!1,h;"circle"===a.nodeName?(g=Uc(a,1.5*Qa),h=Xc):"rect"===a.nodeName&&(g=Vc(a),h=Zc);if(pa||g)ea&&fa(b)&&(e.classed(ga,!f),h(!f,e,b,c)),re(b,e)}function fd(a){var b,c,e,f,g,m,p;D(h.data.targets)||!ea||oa&&!E.altDomain||(b=cc[0],c=cc[1],e=a[0],a=a[1],f=Math.min(b,e),g=Math.max(b,e),m=pa?n:Math.min(c,a),p=pa?s:Math.max(c,a),l.select(".dragarea").attr("x",
f).attr("y",m).attr("width",g-f).attr("height",p-m),l.selectAll(".-shapes").selectAll(".-shape").filter(function(a){return fa(a)}).each(function(a,b){var c=d.select(this),e=c.classed(ga),h=c.classed(dc),l,n,q,r;l=!1;"circle"===this.nodeName?(l=1*c.attr("cx"),n=1*c.attr("cy"),r=Xc,l=f<l&&l<g&&m<n&&n<p):"rect"===this.nodeName&&(l=1*c.attr("x"),n=1*c.attr("y"),q=1*c.attr("width"),r=Zc,l=f<l+q&&l<g&&n<p);l^h&&(c.classed(dc,!h),c.classed(ga,!e),r(!e,c,a,b))}))}function gd(a){!D(h.data.targets)&&ea&&(cc=
a,l.select(".chart").append("rect").attr("class","dragarea").style("opacity",0.1),Sa=!0)}function hd(){!D(h.data.targets)&&ea&&(l.select(".dragarea").transition().duration(100).style("opacity",0).remove(),l.selectAll(".-shape").classed(dc,!1),Sa=!1)}function H(a){var b,c,e,f=Td(),p=f.__max__+1,q,v,t=D(h.data.targets);a=u(a)?a:{};c=u(a.withY)?a.withY:!0;e=u(a.withSubchart)?a.withSubchart:!0;v=u(a.withTransition)?a.withTransition:!0;b=u(a.withUpdateXDomain)?a.withUpdateXDomain:!1;a=u(a.withUpdateOrgXDomain)?
a.withUpdateOrgXDomain:!1;v=v?250:0;a&&(m.domain(d.extent(ob(h.data.targets))),T=m.domain(),E.scale(m).updateScaleExtent(),U.domain(m.domain()),K.scale(U));b&&(m.domain(K.empty()?T:K.extent()),oa&&E.scale(m).updateScaleExtent());z.domain(mb("y"));Y.domain(mb("y2"));l.select(".x.axis").transition().duration(g?v:0).call(g?ua:I).style("opacity",t?0:1);l.select(".y.axis").transition().duration(g?0:v).call(g?I:ua).style("opacity",t?0:1);l.select(".y2.axis").transition().call(jb).style("opacity",t?0:1);
l.select(".x.axis .-axis-x-label").attr("x",r);hb.domain(z.domain());ib.domain(Y.domain());V.style("display","none");l.select("line.xgrid-focus").style("visibility","hidden").attr("y2",s);if(ad){if("year"===se)for(b=[],a=ob(),t=a[0].getFullYear(),a=a[1].getFullYear();t<=a;t++)b.push(new Date(t+"-01-01 00:00:00"));else b=m.ticks(10);b=l.select(".xgrids").selectAll(".xgrid").data(b);b.enter().append("line").attr("class","xgrid");b.attr("x1",g?0:function(a){return m(a)-I.tickOffset()}).attr("x2",g?r:
function(a){return m(a)-I.tickOffset()}).attr("y1",g?function(a){return m(a)-I.tickOffset()}:n).attr("y2",g?function(a){return m(a)-I.tickOffset()}:s).style("opacity",function(){return+d.select(this).attr(g?"y1":"x1")===(g?s:0)?0:1});b.exit().remove()}Yb&&(b=l.selectAll(".xgrid-lines"),b.selectAll("line").transition().duration(v).attr("x1",g?0:Oa).attr("x2",g?r:Oa).attr("y1",g?Oa:n).attr("y2",g?Oa:s),b.selectAll("text").attr("x",g?r:0).attr("y",Oa));c&&bd&&(b=l.select(".ygrids").selectAll(".ygrid").data(z.ticks(10)),
b.enter().append("line").attr("class","ygrid"),b.attr("x1",g?z:0).attr("x2",g?z:r).attr("y1",g?0:z).attr("y2",g?s:z),b.exit().remove());c&&Zb&&(c=l.select(".ygrid-lines"),c.selectAll("line").transition().duration(v).attr("x1",g?Pa:0).attr("x2",g?Pa:r).attr("y1",g?0:Pa).attr("y2",g?s:Pa),c.selectAll("text").attr("x",g?0:r).attr("y",Pa));c=function(a){var b=da?p?1.2*I.tickOffset()/p:0:0.6*((g?s:r)*(a?1:ta(T)/ta(m.domain()))/(fb()-1)),c=Ud(b,p,f,!!a),e=Vd(!!a),d=Wd(f,!!a),h=a?G:w;return function(a,f){var k=
h(a.id)(0),l=d(a,f)||k,k=[[c(a),l],[c(a),e(a)-(k-l)],[c(a)+b,e(a)-(k-l)],[c(a)+b,l]],l=g?1:0,m=g?0:1;return"M "+k[0][l]+","+k[0][m]+" L"+k[1][l]+","+k[1][m]+" L"+k[2][l]+","+k[2][m]+" L"+k[3][l]+","+k[3][m]+" z"}};b=l.selectAll(".-bars").selectAll(".-bar").data(Tc);b.enter().append("path").attr("d",c(!1)).style("stroke","none").style("opacity",0).style("fill",function(a){return J(a.id)}).attr("class",Fc);b.transition().duration(v).attr("d",c(!1)).style("opacity",1);b.exit().transition().duration(v).style("opacity",
0).remove();l.selectAll(".chart-line").select(".-line").transition().duration(v).attr("d",te);l.selectAll(".-area").transition().duration(v).attr("d",ue);b=l.selectAll(".-circles").selectAll(".-circle").data(Xd);b.enter().append("circle").attr("class",Qd).attr("r",Vb);b.transition().duration(v).style("opacity",Sd).attr("cx",g?ya:xa).attr("cy",g?xa:ya);b.exit().remove();l.selectAll(".chart-arc").select(".-arc").style("opacity",function(a){return a===this._current?0:1}).transition().duration(v).attrTween("d",
function(a){a=ia(a);if(!a)return function(){return"M 0 0"};var b=d.interpolate(this._current,a);this._current=b(0);return function(a){a=b(a);return Sc(a.data)?kb(a,!0):"M 0 0"}}).style("opacity",1);l.selectAll(".chart-arc").select("text").attr("transform",Xa).attr("opacity",0).transition().duration(v).text(Ya).attr("opacity",function(a){return Sc(a.data)?1:0});Aa&&(null!==d.event&&"zoom"===d.event.type&&K.extent(m.orgDomain()).update(),e&&(F.select(".x.axis").transition().duration(g?v:0).call(gb),
K.empty()||K.extent(m.orgDomain()).update(),e=F.selectAll(".-bars").selectAll(".-bar").data(Tc),e.enter().append("path").attr("d",c(!0)).style("stroke","none").style("fill",function(a){return J(a.id)}).attr("class",Fc),e.style("opacity",0).transition().duration(v).attr("d",c(!0)).style("opacity",1),e.exit().transition().duration(v).style("opacity",0).remove(),F.selectAll(".-line").transition().duration(v).attr("d",ve)));l.selectAll(".selected-circles").filter(function(a){return sb(a)}).selectAll("circle").remove();
l.selectAll(".selected-circle").transition().duration(v).attr("cx",g?ya:xa).attr("cy",g?xa:ya);Z?(c=l.select(".event-rects").selectAll(".event-rect").data([0]),qe(c.enter()),c.attr("x",0).attr("y",0).attr("width",r).attr("height",s)):(Nb?(q=function(a,b){var c=Ac(b),e=b<fb()-1?h.data.targets[0].values[b+1].x:void 0;return(m(e?e:a.x+50)-m(c?c:a.x-50))/2},e=function(a,b){var c=Ac(b);return(m(a.x)+m(c?c:a.x-50))/2}):(q=md(),e=function(a){return m(a.x)-q/2}),c=Md(),l.select(".event-rects").datum(c?c.values:
[]),c=l.select(".event-rects").selectAll(".event-rect").data(function(a){return a}),pe(c.enter()),c.attr("class",Gc).attr("x",g?0:e).attr("y",g?e:0).attr("width",g?r:q).attr("height",g?q:s),c.exit().remove());e=l.select(".regions").selectAll("rect.region").data(P);e.enter().append("rect");e.attr("class",Rd).attr("x",g?0:Mb).attr("y",g?Mb:n).attr("width",g?r:vc).attr("height",g?vc:s).style("fill-opacity",function(a){return u(a.opacity)?a.opacity:0.1});e.exit().transition().duration(v).style("fill-opacity",
0).remove()}function we(){"mousemove"===d.event.sourceEvent.type&&E.altDomain?(m.domain(E.altDomain),E.scale(m).updateScaleExtent()):(da&&m.orgDomain()[0]===T[0]&&m.domain([T[0]-1E-10,m.orgDomain()[1]]),H({withTransition:!1,withY:!1,withSubchart:!1}),"mousemove"===d.event.sourceEvent.type&&(bc=!0))}function ne(){function a(){b.forEach(function(a){a()})}var b=[];a.add=function(a){b.push(a)};return a}function oe(){qa();Q();K.scale(U);oa&&E.scale(m);p.attr("width",zb).attr("height",ra);p.select("#"+
Xb).select("rect").attr("width",r).attr("height",s);p.select("#xaxis-clip").select("rect").attr("width",M);p.select(".zoom-rect").attr("width",r).attr("height",s);l.select(".x.axis").attr("transform",L.x);l.select(".y2.axis").attr("transform",L.y2);l.select(".chart-arcs").attr("transform",L.arc);Aa&&(F.attr("transform",L.context),F.select(".x.axis").attr("transform",L.subx));Ca&&(Ba.attr("transform",L.legend),wb(h.data.targets,{withTransition:!1}));H({withTransition:!1,withUpdateXDomain:!0})}function cd(a){var b;
l.select(".chart-bars").selectAll(".chart-bar").data(a).enter().append("g").attr("class",function(a){return"chart-bar target target-"+a.id}).style("pointer-events","none").style("opacity",0).append("g").attr("class",Ec).style("fill",function(a){return J(a.id)}).style("stroke",function(a){return J(a.id)}).style("stroke-width",0).style("cursor",function(a){return fa(a)?"pointer":null});b=l.select(".chart-lines").selectAll(".chart-line").data(a).enter().append("g").attr("class",function(a){return"chart-line target target-"+
a.id}).style("pointer-events","none").style("opacity",0);b.append("path").attr("class",Dc).style("stroke",function(a){return J(a.id)});b.append("path").attr("class",Pd).style("fill",function(a){return J(a.id)});b.append("g").attr("class",function(a){return"selected-circles selected-circles-"+a.id});b.append("g").attr("class",Nd).style("fill",function(a){return J(a.id)}).style("cursor",function(a){return fa(a)?"pointer":null});a.forEach(function(a){l.selectAll(".selected-circles-"+a.id).selectAll(".selected-circle").each(function(b){b.value=
a.values[b.x].value})});b=l.select(".chart-arcs").selectAll(".chart-arc").data(Lb(a)).enter().append("g").attr("class",function(a){return"chart-arc target target-"+a.data.id}).style("opacity",0);b.append("path").attr("class",Od).style("fill",function(a){return J(a.data.id)}).style("cursor",function(a){return fa(a)?"pointer":null}).each(function(a){this._current=a}).on("mouseover",function(a){Za(a.data.id);ec(a.data.id)}).on("mouseout",function(a){xb(a.data.id);fc()});b.append("text").attr("dy",".35em").style("text-anchor",
"middle").style("pointer-events","none");Aa&&(b=F.select(".chart-bars").selectAll(".chart-bar").data(a),b=b.enter().append("g").attr("class",function(a){return"chart-bar target target-"+a.id}).style("opacity",0),b.append("g").attr("class",Ec).style("fill",function(a){return J(a.id)}),b=F.select(".chart-lines").selectAll(".chart-line").data(a),b=b.enter().append("g").attr("class",function(a){return"chart-line target target-"+a.id}).style("opacity",0),b.append("path").attr("class",Dc).style("stroke",
function(a){return J(a.id)}));Ca&&wb(a);p.selectAll(".target").transition().style("opacity",1)}function Ta(a,b){h.data.targets.forEach(function(b){for(var e=0;e<a.length;e++)if(b.id===a[e].id){b.values=a[e].values;a.splice(e,1);break}});h.data.targets=h.data.targets.concat(a);cd(h.data.targets);H({withUpdateOrgXDomain:!0,withUpdateXDomain:!0});b()}function ec(a){var b=p.selectAll(".legend-item"),c=function(b){return!a||b===a};b.filter(function(a){return!c(a)}).transition().duration(100).style("opacity",
0.3);b.filter(c).transition().duration(100).style("opacity",1)}function xe(a){var b=p.selectAll(".legend-item"),c=function(b){return!a||b===a};b.filter(function(a){return!c(a)}).transition().duration(100).style("opacity",1);b.filter(c).transition().duration(100).style("opacity",0.3)}function fc(){p.selectAll(".legend-item").transition().duration(100).style("opacity",1)}function wb(a,b){var c=rb(a),e,d=r/2-Ua*Object.keys(a).length/2,f;b=x(b)?{}:b;f=u(b.withTransition)?b.withTransition:!0;e=Ba.selectAll(".legend-item").data(c).enter().append("g").attr("class",
function(a){return"legend-item legend-item-"+a}).style("cursor","pointer").on("click",function(a){ye(a)}).on("mouseover",function(a){ec(a);h.focus(a)}).on("mouseout",function(){fc();h.revert()});e.append("rect").attr("class","legend-item-event").style("fill-opacity",0).attr("x",-200).attr("y",function(){return ka/2-16}).attr("width",Ua).attr("height",24);e.append("rect").attr("class","legend-item-tile").style("pointer-events","none").style("fill",function(a){return J(a)}).attr("x",-200).attr("y",
function(){return ka/2-9}).attr("width",10).attr("height",10);e.append("text").text(function(a){return u(Ka[a])?Ka[a]:a}).style("pointer-events","none").attr("x",-200).attr("y",function(){return ka/2});Ba.selectAll("rect.legend-item-event").data(c).transition().duration(f?250:0).attr("x",function(a,b){return d+Ua*b});Ba.selectAll("rect.legend-item-tile").data(c).transition().duration(f?250:0).attr("x",function(a,b){return d+Ua*b});Ba.selectAll("text").data(c).transition().duration(f?250:0).attr("x",
function(a,b){return d+Ua*b+14})}function Va(a){return u(a)?".target-"+a:".target"}function gc(a){return Bc(a.id)}function hc(a){return"data"in a&&Bc(a.data.id)}var h={data:{}},pb={},$="_expanded_",ga="_selected_",dc="_included_",sa=f(["bindto"],"#chart"),$a=f(["size","width"],null),oc=f(["size","height"],null),ab=f(["padding","left"],null),cb=f(["padding","right"],null),oa=f(["zoom","enabled"],!1),id=f(["zoom","extent"],null),le=f(["zoom","privileged"],!1),ge=f(["onenter"],function(){}),he=f(["onleave"],
function(){});if(!("data"in aa))throw Error("data is required in config");var na=f(["data","x"],null),Z=f(["data","xs"],null),Qb=f(["data","x_format"],"%Y-%m-%d"),Ld=f(["data","id_converter"],function(a){return a}),Ka=f(["data","names"],{}),t=f(["data","groups"],[]),rc=f(["data","axes"],{}),zc=f(["data","type"],null),C=f(["data","types"],{}),jd=f(["data","regions"],{}),ze=f(["data","colors"],{}),ea=f(["data","selection","enabled"],!1),pa=f(["data","selection","grouped"],!1),fa=f(["data","selection",
"isselectable"],function(){return!0}),Aa=f(["subchart","show"],!1),Ab=Aa?f(["subchart","size","height"],60):0,Ae=f(["color","pattern"],null),Ca=f(["legend","show"],!0),Ua=f(["legend","item","width"],80),ye=f(["legend","item","onclick"],function(){}),kd=f(["axis","x","type"],"indexed"),Ha=f(["axis","x","categories"],[]),rd=f(["axis","x","tick","centered"],!1),lb=f(["axis","x","tick","format"],null),vb=f(["axis","x","default"],null),ie=f(["axis","x","label"],null),Bd=f(["axis","y","max"],null),zd=f(["axis",
"y","min"],null),Dd=f(["axis","y","center"],null),je=f(["axis","y","label"],null),bb=f(["axis","y","inner"],!1),de=f(["axis","y","tick","format"],function(a){return a}),Ia=f(["axis","y","padding"],null),ce=f(["axis","y","ticks"],10),Bb=f(["axis","y2","show"],!1),Ad=f(["axis","y2","max"],null),yd=f(["axis","y2","min"],null),Cd=f(["axis","y2","center"],null),db=f(["axis","y2","inner"],!1),fe=f(["axis","y2","tick","format"],function(a){return a}),Ja=f(["axis","y2","padding"],null),ee=f(["axis","y2",
"ticks"],10),g=f(["axis","rotated"],!1),ad=f(["grid","x","show"],!1),se=f(["grid","x","type"],"tick"),Yb=f(["grid","x","lines"],null),bd=f(["grid","y","show"],!1),Zb=f(["grid","y","lines"],null),Vb=f(["point","show"],!0)?f(["point","r"],2.5):0,ke=f(["point","focus","line","enabled"],!0),$b=f(["point","focus","expand","enabled"],!0),ac=f(["point","focus","expand","r"],$b?4:Vb),Qa=f(["point","focus","select","r"],8),re=f(["point","onclick"],function(){}),Zd=f(["point","onselected"],function(){}),$d=
f(["point","onunselected"],function(){}),ud=f(["arc","label","format"],function(a,b){return b.toFixed(1)+"%"}),P=f(["regions"],[]),Oc=f(["tooltip","contents"],function(a){var b="<table class='-tooltip'><tr><th colspan='2'>"+lc()(a[0].x)+"</th></tr>",c,d,f;for(c=0;c<a.length;c++)a[c]&&(a[c].value||0===a[c].value)&&(d=u(a[c].value)?(Math.round(100*a[c].value)/100).toFixed(2):"-",f=a[c].name,b+="<tr class='-tooltip-name-"+a[c].id+"'><td class='name'><span style='background-color:"+J(a[c].id)+"'></span>"+
f+"</td><td class='value'>"+d+"</td></tr>");return b+"</table>"}),me=f(["tooltip","init","show"],!1),Da=f(["tooltip","init","x"],0),dd=f(["tooltip","init","position"],{top:"0px",left:"50px"}),Xb=sa.replace("#","")+"-clip",Ra="url(#"+Xb+")",B="timeseries"===kd,da="categorized"===kd,Nb=!B&&(na||Z),cc=null,Sa=!1,bc=!1,ka=Ca?40:0,J=function(a,b){var c=[],d=null!==b?b:"#1f77b4 #ff7f0e #2ca02c #d62728 #9467bd #8c564b #e377c2 #7f7f7f #bcbd22 #17becf".split(" ");return function(b){if(b in a)return a[b];-1===
c.indexOf(b)&&c.push(b);return d[c.indexOf(b)%d.length]}}(ze,Ae),sd=function(){var a=[[d.time.format("%Y/%-m/%-d"),function(){return!0}],[d.time.format("%-m/%-d"),function(a){return a.getMonth()}],[d.time.format("%-m/%-d"),function(a){return 1!==a.getDate()}],[d.time.format("%-m/%-d"),function(a){return a.getDay()&&1!==a.getDate()}],[d.time.format("%I %p"),function(a){return a.getHours()}],[d.time.format("%I:%M"),function(a){return a.getMinutes()}],[d.time.format(":%S"),function(a){return a.getSeconds()}],
[d.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)}}(),r,Cb,s,eb,zb,ra,Ga,Db,Eb,kb,pc,qc,Lb,Fb,Gb,Hb,Ib,Jb,Kb,m,z,Y,U,hb,ib,I,ua,jb,gb,nd=g?"left":"bottom",od=g?bb?"top":"bottom":bb?"right":"left",pd=g?db?"bottom":"top":db?"left":"right",qd=g?"left":"bottom",L={main:function(){return"translate("+A+","+n+")"},context:function(){return"translate("+Fa+","+Ea+")"},legend:function(){return"translate("+jc+","+
ic+")"},y2:function(){return"translate("+(g?0:r)+","+(g?10:0)+")"},x:function(){return"translate(0,"+s+")"},subx:function(){return"translate(0,"+(g?0:eb)+")"},arc:function(){return"translate("+r/2+","+s/2+")"}},nc=40,mc=20;Lb=d.layout.pie().value(function(a){return a.values.reduce(function(a,c){return a+c.value},0)});var te=function(){var a=d.svg.line().x(g?function(a){return w(a.id)(a.value)}:wa).y(g?wa:function(a){return w(a.id)(a.value)});return function(b){var c=Sb(b.values),d;if(Pb(b))return Rc(b)?
a.interpolate("cardinal"):a.interpolate("linear"),jd[b.id]?be(c,m,w(b.id),jd[b.id]):a(c);d=m(c[0].x);b=w(b.id)(c[0].value);return g?"M "+b+" "+d:"M "+d+" "+b}}(),ue=function(){var a;a=g?d.svg.area().x0(function(a){return w(a.id)(0)}).x1(function(a){return w(a.id)(a.value)}).y(wa):d.svg.area().x(wa).y0(function(a){return w(a.id)(0)}).y1(function(a){return w(a.id)(a.value)});return function(b){var c=Sb(b.values),d;if(la([b],"area")||la([b],"area-spline"))return Rc(b)?a.interpolate("cardinal"):a.interpolate("linear"),
a(c);d=m(c[0].x);b=w(b.id)(c[0].value);return g?"M "+b+" "+d:"M "+d+" "+b}}(),ve=function(){var a=d.svg.line().x(g?function(a){return G(a.id)(a.value)}:Ic).y(g?Ic:function(a){return G(a.id)(a.value)});return function(b){var c=Sb(b.values);return Pb(b)?a(c):"M "+U(c[0].x)+" "+G(b.id)(c[0].value)}}(),K=d.svg.brush().on("brush",function(){H({withTransition:!1,withY:!1,withSubchart:!1,withUpdateXDomain:!0})}),E=d.behavior.zoom().on("zoomstart",function(){E.altDomain=d.event.sourceEvent.altKey?m.orgDomain():
null}).on("zoom",oa?we:null);K.update=function(){F&&F.select(".x.brush").call(this);return this};K.scale=function(a){return g?this.y(a):this.x(a)};E.scale=function(a){return g?this.y(a):this.x(a)};E.orgScaleExtent=function(){var a=id?id:[1,10];return[a[0],Math.max(fb()/a[1],a[1])]};E.updateScaleExtent=function(){var a=ta(m.orgDomain())/ta(T),b=this.orgScaleExtent();this.scaleExtent([b[0]*a,b[1]*a]);return this};var p,ub,l,F,Ba,V,tb,T;h.focus=function(a){var b=p.selectAll(Va(a)),c=b.filter(gc),b=b.filter(hc);
h.revert();h.defocus();c.classed("focused",!0).transition().duration(100).style("opacity",1);b.transition().duration(100).style("opacity",1);D(h.data.targets)&&Za(a,!0);ec(a)};h.defocus=function(a){var b=p.selectAll(Va(a)),c=b.filter(gc),b=b.filter(hc);h.revert();c.classed("focused",!1).transition().duration(100).style("opacity",0.3);b.transition().duration(100).style("opacity",0.3);D(h.data.targets)&&xb(a);xe(a)};h.revert=function(a){var b=p.selectAll(Va(a)),c=b.filter(gc),b=b.filter(hc);c.classed("focused",
!1).transition().duration(100).style("opacity",1);b.transition().duration(100).style("opacity",1);D(h.data.targets)&&xb(a);fc()};h.show=function(a){p.selectAll(Va(a)).transition().style("opacity",1)};h.hide=function(a){p.selectAll(Va(a)).transition().style("opacity",0)};h.unzoom=function(){K.clear().update();H({withUpdateXDomain:!0})};h.load=function(a){"function"!==typeof a.done&&(a.done=function(){});a.xs&&Kd(a.xs);"categories"in a&&da&&(Ha=a.categories,I.categories(Ha));if("cacheIds"in a&&Gd(a.cacheIds))Ta(Hd(a.cacheIds),
a.done);else if("data"in a)Ta(La(a.data),a.done);else if("url"in a)d.csv(a.url,function(b,c){Ta(La(c),a.done)});else if("rows"in a)Ta(La(xc(a.rows)),a.done);else if("columns"in a)Ta(La(yc(a.columns)),a.done);else throw Error("url or rows or columns is required.");};h.unload=function(a){h.data.targets=h.data.targets.filter(function(b){return b.id!==a});p.selectAll(".target-"+a).transition().style("opacity",0).remove();Ca&&(p.selectAll(".legend-item-"+a).remove(),wb(h.data.targets));0<h.data.targets.length&&
H({withUpdateOrgXDomain:!0,withUpdateXDomain:!0})};h.selected=function(a){a=u(a)?"-"+a:"";return d.merge(l.selectAll(".-shapes"+a).selectAll(".-shape").filter(function(){return d.select(this).classed(ga)}).map(function(a){return a.map(function(a){return a.__data__})}))};h.select=function(a,b,c){ea&&l.selectAll(".-shapes").selectAll(".-shape").each(function(e,f){var g="circle"===this.nodeName?Wc:ae,h="circle"===this.nodeName?Rb:Yc;0<=b.indexOf(f)?fa(e)&&(pa||x(a)||0<=a.indexOf(e.id))&&g(d.select(this).classed(ga,
!0),e,f):u(c)&&c&&h(d.select(this).classed(ga,!1),e,f)})};h.unselect=function(a,b){ea&&l.selectAll(".-shapes").selectAll(".-shape").each(function(c,e){var f="circle"===this.nodeName?Rb:Yc;(x(b)||0<=b.indexOf(e))&&fa(c)&&(pa||x(a)||0<=a.indexOf(c.id))&&f(d.select(this).classed(ga,!1),c,e)})};h.toLine=function(a){Ma(a,"line");H()};h.toSpline=function(a){Ma(a,"spline");H()};h.toBar=function(a){Ma(a,"bar");H()};h.toScatter=function(a){Ma(a,"scatter");H()};h.groups=function(a){if(x(a))return t;t=a;H();
return t};h.regions=function(a){if(x(a))return P;P=a;H();return P};h.regions.add=function(a){if(x(a))return P;P=P.concat(a);H();return P};h.regions.remove=function(a,b){var c=[].concat(a);b=u(b)?b:{};c.forEach(function(a){var c=p.selectAll("."+a);u(b.duration)&&(c=c.transition().duration(b.duration).style("fill-opacity",0));c.remove();P=P.filter(function(b){return 0>b.classes.indexOf(a)})});return P};h.data.get=function(a){a=h.data.getAsTarget(a);return u(a)?a.values.map(function(a){return a.value}):
void 0};h.data.getAsTarget=function(a){var b=nb(function(b){return b.id===a});return 0<b.length?b[0]:void 0};h.destroy=function(){h.data.targets=void 0;h.data.x={};tb.html("");O.onresize=null};if("url"in aa.data)d.csv(aa.data.url,function(a,b){Wb(b)});else if("rows"in aa.data)Wb(xc(aa.data.rows));else if("columns"in aa.data)Wb(yc(aa.data.columns));else throw Error("url or rows or columns is required.");return h}})(window);
r).attr("dy","-.5em").style("text-anchor","end").text(je);l.append("g").attr("class","y axis").attr("clip-path",g?"url(#yaxis-clip)":"").call(g?I:ua).append("text").attr("transform","rotate(-90)").attr("dy","1.2em").attr("dx","-.5em").style("text-anchor","end").text(ke);Bb&&l.append("g").attr("class","y2 axis").attr("transform",L.y2).call(jb);a=l.append("g").attr("clip-path",Ra).attr("class","grid");bd&&a.append("g").attr("class","xgrids");Zb&&(b=a.append("g").attr("class","xgrid-lines").selectAll(".xgrid-line").data(Zb).enter().append("g").attr("class",
"xgrid-line"),b.append("line").attr("class",function(a){return""+a["class"]}),b.append("text").attr("class",function(a){return""+a["class"]}).attr("text-anchor","end").attr("transform",g?"":"rotate(-90)").attr("dx",g?0:-n).attr("dy",-5).text(function(a){return a.text}));le&&a.append("g").attr("class","xgrid-focus").append("line").attr("class","xgrid-focus").attr("x1",g?0:-10).attr("x2",g?r:-10).attr("y1",g?-10:n).attr("y2",g?-10:s);cd&&a.append("g").attr("class","ygrids");$b&&(a=a.append("g").attr("class",
"ygrid-lines").selectAll("ygrid-line").data($b).enter().append("g").attr("class","ygrid-line"),a.append("line").attr("class",function(a){return""+a["class"]}),a.append("text").attr("class",function(a){return""+a["class"]}).attr("text-anchor","end").attr("transform",g?"rotate(-90)":"").attr("dx",g?0:-n).attr("dy",-5).text(function(a){return a.text}));l.append("g").attr("clip-path",Ra).attr("class","regions");l.append("g").attr("clip-path",Ra).attr("class","chart");l.select(".chart").append("g").attr("class",
"event-rects").style("fill-opacity",0).style("cursor",oa?"ew-resize":null);l.select(".chart").append("g").attr("class","chart-bars");l.select(".chart").append("g").attr("class","chart-lines");l.select(".chart").append("g").attr("class","chart-arcs").attr("transform",L.arc).append("text").attr("class","chart-arcs-title").style("text-anchor","middle").text(me);if(oa)l.insert("rect",ne?null:"g.grid").attr("class","zoom-rect").attr("width",r).attr("height",s).style("opacity",0).style("cursor","ew-resize").call(E).on("dblclick.zoom",
null);null!==vb&&K.extent("function"!==typeof vb?vb:vb(ob()));Aa&&(F.append("g").attr("clip-path",Ra).attr("class","chart"),F.select(".chart").append("g").attr("class","chart-bars"),F.select(".chart").append("g").attr("class","chart-lines"),F.append("g").attr("clip-path",Ra).attr("class","x brush").call(K).selectAll("rect").attr(g?"width":"height",g?Cb:eb),F.append("g").attr("class","x axis").attr("transform",L.subx).attr("clip-path",g?"url(#yaxis-clip)":"").call(gb));Ca&&wb(h.data.targets);dd(h.data.targets);
H({withTransition:!1,withUpdateXDomain:!0});if(oe){if(B&&"string"===typeof Da){Da=ma(Da);for(a=0;a<h.data.targets[0].values.length&&0!==h.data.targets[0].values[a].x-Da;a++);Da=a}V.html(Pc(h.data.targets.map(function(a){return qb(a.values[Da])})));V.style("top",ed.top).style("left",ed.left).style("display","block")}null==O.onresize&&(O.onresize=pe());O.onresize.add&&O.onresize.add(qe)}}function re(a){a.append("rect").attr("class",Hc).style("cursor",ea&&pa?"pointer":null).on("mouseover",function(a,
c){if(!Sa&&!D(h.data.targets)){var e=h.data.targets.map(function(a){return qb(a.values[c])}),d,f;if(0<Object.keys(Ka).length){f=[];for(var g in Ka)for(d=0;d<e.length;d++)if(e[d].id===g){f.push(e[d]);e.shift(d);break}e=f.concat(e)}ac&&Ub(c,void 0).classed($,!0).attr("r",bc);ad(c).classed($,!1);Qc(e[0])}}).on("mouseout",function(a,c){D(h.data.targets)||(Rc(),V.style("display","none"),Vb(c),ad(void 0).classed($,!1))}).on("mousemove",function(a,c){var e;Sa||D(h.data.targets)||(e=h.data.targets.map(function(a){return qb(a.values[c])}),
Oc(e,d.mouse(this)),ea&&(pa||l.selectAll(".-shape-"+c).filter(function(a){return fa(a)}).each(function(){var a=d.select(this).classed($,!0);"circle"===this.nodeName&&a.attr("r",bc);p.select(".event-rect-"+c).style("cursor",null)}).filter(function(){var a=d.select(this);if("circle"===this.nodeName)return Vc(this,Qa);if("rect"===this.nodeName)return Wc(this,a.attr("x"),a.attr("y"))}).each(function(){var a=d.select(this);a.classed($)||(a.classed($,!0),"circle"===this.nodeName&&a.attr("r",Qa));p.select(".event-rect-"+
c).style("cursor","pointer")})))}).on("click",function(a,c){D(h.data.targets)||(cc?cc=!1:l.selectAll(".-shape-"+c).each(function(a){fd(this,a,c)}))}).call(d.behavior.drag().origin(Object).on("drag",function(){gd(d.mouse(this))}).on("dragstart",function(){hd(d.mouse(this))}).on("dragend",function(){id()})).call(E).on("dblclick.zoom",null)}function se(a){a.append("rect").attr("x",0).attr("y",0).attr("width",r).attr("height",s).attr("class","event-rect").on("mouseout",function(){D(h.data.targets)||(Rc(),
V.style("display","none"),Vb())}).on("mousemove",function(){var a,c,e;Sa||D(h.data.targets)||(a=d.mouse(this),c=Nc(h.data.targets,a),e=[qb(c)],Oc(e,a),ac&&(Vb(),Ub(c.index,c.id).classed($,!0).attr("r",bc)),Qc(e[0]),100>Pb(c,a)?p.select(".event-rect").style("cursor","pointer"):p.select(".event-rect").style("cursor",null))}).on("click",function(){var a,c;D(h.data.targets)||(a=d.mouse(this),c=Nc(h.data.targets,a),100>Pb(c,a)&&l.select(".-circles-"+c.id).select(".-circle-"+c.index).each(function(){fd(this,
c,c.index)}))}).call(d.behavior.drag().origin(Object).on("drag",function(){gd(d.mouse(this))}).on("dragstart",function(){hd(d.mouse(this))}).on("dragend",function(){id()})).call(E).on("dblclick.zoom",null)}function fd(a,b,c){var e=d.select(a),f=e.classed(ga),g=!1,h;"circle"===a.nodeName?(g=Vc(a,1.5*Qa),h=Yc):"rect"===a.nodeName&&(g=Wc(a),h=$c);if(pa||g)ea&&fa(b)&&(e.classed(ga,!f),h(!f,e,b,c)),te(b,e)}function gd(a){var b,c,e,f,g,m,p;D(h.data.targets)||!ea||oa&&!E.altDomain||(b=dc[0],c=dc[1],e=a[0],
a=a[1],f=Math.min(b,e),g=Math.max(b,e),m=pa?n:Math.min(c,a),p=pa?s:Math.max(c,a),l.select(".dragarea").attr("x",f).attr("y",m).attr("width",g-f).attr("height",p-m),l.selectAll(".-shapes").selectAll(".-shape").filter(function(a){return fa(a)}).each(function(a,b){var c=d.select(this),e=c.classed(ga),h=c.classed(ec),l,n,q,r;l=!1;"circle"===this.nodeName?(l=1*c.attr("cx"),n=1*c.attr("cy"),r=Yc,l=f<l&&l<g&&m<n&&n<p):"rect"===this.nodeName&&(l=1*c.attr("x"),n=1*c.attr("y"),q=1*c.attr("width"),r=$c,l=f<
l+q&&l<g&&n<p);l^h&&(c.classed(ec,!h),c.classed(ga,!e),r(!e,c,a,b))}))}function hd(a){!D(h.data.targets)&&ea&&(dc=a,l.select(".chart").append("rect").attr("class","dragarea").style("opacity",0.1),Sa=!0)}function id(){!D(h.data.targets)&&ea&&(l.select(".dragarea").transition().duration(100).style("opacity",0).remove(),l.selectAll(".-shape").classed(ec,!1),Sa=!1)}function H(a){var b,c,e,f=Ud(),p=f.__max__+1,q,v,t=D(h.data.targets);a=u(a)?a:{};c=u(a.withY)?a.withY:!0;e=u(a.withSubchart)?a.withSubchart:
!0;v=u(a.withTransition)?a.withTransition:!0;b=u(a.withUpdateXDomain)?a.withUpdateXDomain:!1;a=u(a.withUpdateOrgXDomain)?a.withUpdateOrgXDomain:!1;v=v?250:0;a&&(m.domain(d.extent(ob(h.data.targets))),T=m.domain(),E.scale(m).updateScaleExtent(),U.domain(m.domain()),K.scale(U));b&&(m.domain(K.empty()?T:K.extent()),oa&&E.scale(m).updateScaleExtent());z.domain(mb("y"));Y.domain(mb("y2"));l.select(".x.axis").transition().duration(g?v:0).call(g?ua:I).style("opacity",t?0:1);l.select(".y.axis").transition().duration(g?
0:v).call(g?I:ua).style("opacity",t?0:1);l.select(".y2.axis").transition().call(jb).style("opacity",t?0:1);l.select(".x.axis .-axis-x-label").attr("x",r);hb.domain(z.domain());ib.domain(Y.domain());V.style("display","none");l.select("line.xgrid-focus").style("visibility","hidden").attr("y2",s);if(bd){if("year"===ue)for(b=[],a=ob(),t=a[0].getFullYear(),a=a[1].getFullYear();t<=a;t++)b.push(new Date(t+"-01-01 00:00:00"));else b=m.ticks(10);b=l.select(".xgrids").selectAll(".xgrid").data(b);b.enter().append("line").attr("class",
"xgrid");b.attr("x1",g?0:function(a){return m(a)-I.tickOffset()}).attr("x2",g?r:function(a){return m(a)-I.tickOffset()}).attr("y1",g?function(a){return m(a)-I.tickOffset()}:n).attr("y2",g?function(a){return m(a)-I.tickOffset()}:s).style("opacity",function(){return+d.select(this).attr(g?"y1":"x1")===(g?s:0)?0:1});b.exit().remove()}Zb&&(b=l.selectAll(".xgrid-lines"),b.selectAll("line").transition().duration(v).attr("x1",g?0:Oa).attr("x2",g?r:Oa).attr("y1",g?Oa:n).attr("y2",g?Oa:s),b.selectAll("text").attr("x",
g?r:0).attr("y",Oa));c&&cd&&(b=l.select(".ygrids").selectAll(".ygrid").data(z.ticks(10)),b.enter().append("line").attr("class","ygrid"),b.attr("x1",g?z:0).attr("x2",g?z:r).attr("y1",g?0:z).attr("y2",g?s:z),b.exit().remove());c&&$b&&(c=l.select(".ygrid-lines"),c.selectAll("line").transition().duration(v).attr("x1",g?Pa:0).attr("x2",g?Pa:r).attr("y1",g?0:Pa).attr("y2",g?s:Pa),c.selectAll("text").attr("x",g?0:r).attr("y",Pa));c=function(a){var b=da?p?1.2*I.tickOffset()/p:0:0.6*((g?s:r)*(a?1:ta(T)/ta(m.domain()))/
(fb()-1)),c=Vd(b,p,f,!!a),e=Wd(!!a),d=Xd(f,!!a),h=a?G:w;return function(a,f){var k=h(a.id)(0),l=d(a,f)||k,k=[[c(a),l],[c(a),e(a)-(k-l)],[c(a)+b,e(a)-(k-l)],[c(a)+b,l]],l=g?1:0,m=g?0:1;return"M "+k[0][l]+","+k[0][m]+" L"+k[1][l]+","+k[1][m]+" L"+k[2][l]+","+k[2][m]+" L"+k[3][l]+","+k[3][m]+" z"}};b=l.selectAll(".-bars").selectAll(".-bar").data(Uc);b.enter().append("path").attr("d",c(!1)).style("stroke","none").style("opacity",0).style("fill",function(a){return J(a.id)}).attr("class",Gc);b.transition().duration(v).attr("d",
c(!1)).style("opacity",1);b.exit().transition().duration(v).style("opacity",0).remove();l.selectAll(".chart-line").select(".-line").transition().duration(v).attr("d",ve);l.selectAll(".-area").transition().duration(v).attr("d",we);b=l.selectAll(".-circles").selectAll(".-circle").data(Yd);b.enter().append("circle").attr("class",Rd).attr("r",Wb);b.transition().duration(v).style("opacity",Td).attr("cx",g?ya:xa).attr("cy",g?xa:ya);b.exit().remove();l.selectAll(".chart-arc").select(".-arc").style("opacity",
function(a){return a===this._current?0:1}).transition().duration(v).attrTween("d",function(a){a=ia(a);if(!a)return function(){return"M 0 0"};var b=d.interpolate(this._current,a);this._current=b(0);return function(a){a=b(a);return Tc(a.data)||Mb(a.data)?kb(a,!0):"M 0 0"}}).style("opacity",1);l.selectAll(".chart-arc").select("text").attr("transform",Xa).attr("opacity",0).transition().duration(v).text(Ya).attr("opacity",function(a){return Tc(a.data)||Mb(a.data)?1:0});Aa&&(null!==d.event&&"zoom"===d.event.type&&
K.extent(m.orgDomain()).update(),e&&(F.select(".x.axis").transition().duration(g?v:0).call(gb),K.empty()||K.extent(m.orgDomain()).update(),e=F.selectAll(".-bars").selectAll(".-bar").data(Uc),e.enter().append("path").attr("d",c(!0)).style("stroke","none").style("fill",function(a){return J(a.id)}).attr("class",Gc),e.style("opacity",0).transition().duration(v).attr("d",c(!0)).style("opacity",1),e.exit().transition().duration(v).style("opacity",0).remove(),F.selectAll(".-line").transition().duration(v).attr("d",
xe)));l.selectAll(".selected-circles").filter(function(a){return sb(a)}).selectAll("circle").remove();l.selectAll(".selected-circle").transition().duration(v).attr("cx",g?ya:xa).attr("cy",g?xa:ya);Z?(c=l.select(".event-rects").selectAll(".event-rect").data([0]),se(c.enter()),c.attr("x",0).attr("y",0).attr("width",r).attr("height",s)):(Ob?(q=function(a,b){var c=Bc(b),e=b<fb()-1?h.data.targets[0].values[b+1].x:void 0;return(m(e?e:a.x+50)-m(c?c:a.x-50))/2},e=function(a,b){var c=Bc(b);return(m(a.x)+m(c?
c:a.x-50))/2}):(q=nd(),e=function(a){return m(a.x)-q/2}),c=Nd(),l.select(".event-rects").datum(c?c.values:[]),c=l.select(".event-rects").selectAll(".event-rect").data(function(a){return a}),re(c.enter()),c.attr("class",Hc).attr("x",g?0:e).attr("y",g?e:0).attr("width",g?r:q).attr("height",g?q:s),c.exit().remove());e=l.select(".regions").selectAll("rect.region").data(P);e.enter().append("rect");e.attr("class",Sd).attr("x",g?0:Nb).attr("y",g?Nb:n).attr("width",g?r:wc).attr("height",g?wc:s).style("fill-opacity",
function(a){return u(a.opacity)?a.opacity:0.1});e.exit().transition().duration(v).style("fill-opacity",0).remove()}function ye(){"mousemove"===d.event.sourceEvent.type&&E.altDomain?(m.domain(E.altDomain),E.scale(m).updateScaleExtent()):(da&&m.orgDomain()[0]===T[0]&&m.domain([T[0]-1E-10,m.orgDomain()[1]]),H({withTransition:!1,withY:!1,withSubchart:!1}),"mousemove"===d.event.sourceEvent.type&&(cc=!0))}function pe(){function a(){b.forEach(function(a){a()})}var b=[];a.add=function(a){b.push(a)};return a}
function qe(){qa();Q();K.scale(U);oa&&E.scale(m);p.attr("width",zb).attr("height",ra);p.select("#"+Yb).select("rect").attr("width",r).attr("height",s);p.select("#xaxis-clip").select("rect").attr("width",M);p.select(".zoom-rect").attr("width",r).attr("height",s);l.select(".x.axis").attr("transform",L.x);l.select(".y2.axis").attr("transform",L.y2);l.select(".chart-arcs").attr("transform",L.arc);Aa&&(F.attr("transform",L.context),F.select(".x.axis").attr("transform",L.subx));Ca&&(Ba.attr("transform",
L.legend),wb(h.data.targets,{withTransition:!1}));H({withTransition:!1,withUpdateXDomain:!0})}function dd(a){var b;l.select(".chart-bars").selectAll(".chart-bar").data(a).enter().append("g").attr("class",function(a){return"chart-bar target target-"+a.id}).style("pointer-events","none").style("opacity",0).append("g").attr("class",Fc).style("fill",function(a){return J(a.id)}).style("stroke",function(a){return J(a.id)}).style("stroke-width",0).style("cursor",function(a){return fa(a)?"pointer":null});
b=l.select(".chart-lines").selectAll(".chart-line").data(a).enter().append("g").attr("class",function(a){return"chart-line target target-"+a.id}).style("pointer-events","none").style("opacity",0);b.append("path").attr("class",Ec).style("stroke",function(a){return J(a.id)});b.append("path").attr("class",Qd).style("fill",function(a){return J(a.id)});b.append("g").attr("class",function(a){return"selected-circles selected-circles-"+a.id});b.append("g").attr("class",Od).style("fill",function(a){return J(a.id)}).style("cursor",
function(a){return fa(a)?"pointer":null});a.forEach(function(a){l.selectAll(".selected-circles-"+a.id).selectAll(".selected-circle").each(function(b){b.value=a.values[b.x].value})});b=l.select(".chart-arcs").selectAll(".chart-arc").data(Lb(a)).enter().append("g").attr("class",function(a){return"chart-arc target target-"+a.data.id}).style("opacity",0);b.append("path").attr("class",Pd).style("fill",function(a){return J(a.data.id)}).style("cursor",function(a){return fa(a)?"pointer":null}).each(function(a){this._current=
a}).on("mouseover",function(a){Za(a.data.id);fc(a.data.id)}).on("mouseout",function(a){xb(a.data.id);gc()});b.append("text").attr("dy",".35em").style("text-anchor","middle").style("pointer-events","none");Aa&&(b=F.select(".chart-bars").selectAll(".chart-bar").data(a),b=b.enter().append("g").attr("class",function(a){return"chart-bar target target-"+a.id}).style("opacity",0),b.append("g").attr("class",Fc).style("fill",function(a){return J(a.id)}),b=F.select(".chart-lines").selectAll(".chart-line").data(a),
b=b.enter().append("g").attr("class",function(a){return"chart-line target target-"+a.id}).style("opacity",0),b.append("path").attr("class",Ec).style("stroke",function(a){return J(a.id)}));Ca&&wb(a);p.selectAll(".target").transition().style("opacity",1)}function Ta(a,b){h.data.targets.forEach(function(b){for(var e=0;e<a.length;e++)if(b.id===a[e].id){b.values=a[e].values;a.splice(e,1);break}});h.data.targets=h.data.targets.concat(a);dd(h.data.targets);H({withUpdateOrgXDomain:!0,withUpdateXDomain:!0});
b()}function fc(a){var b=p.selectAll(".legend-item"),c=function(b){return!a||b===a};b.filter(function(a){return!c(a)}).transition().duration(100).style("opacity",0.3);b.filter(c).transition().duration(100).style("opacity",1)}function ze(a){var b=p.selectAll(".legend-item"),c=function(b){return!a||b===a};b.filter(function(a){return!c(a)}).transition().duration(100).style("opacity",1);b.filter(c).transition().duration(100).style("opacity",0.3)}function gc(){p.selectAll(".legend-item").transition().duration(100).style("opacity",
1)}function wb(a,b){var c=rb(a),e,d=r/2-Ua*Object.keys(a).length/2,f;b=x(b)?{}:b;f=u(b.withTransition)?b.withTransition:!0;e=Ba.selectAll(".legend-item").data(c).enter().append("g").attr("class",function(a){return"legend-item legend-item-"+a}).style("cursor","pointer").on("click",function(a){Ae(a)}).on("mouseover",function(a){fc(a);h.focus(a)}).on("mouseout",function(){gc();h.revert()});e.append("rect").attr("class","legend-item-event").style("fill-opacity",0).attr("x",-200).attr("y",function(){return ka/
2-16}).attr("width",Ua).attr("height",24);e.append("rect").attr("class","legend-item-tile").style("pointer-events","none").style("fill",function(a){return J(a)}).attr("x",-200).attr("y",function(){return ka/2-9}).attr("width",10).attr("height",10);e.append("text").text(function(a){return u(Ka[a])?Ka[a]:a}).style("pointer-events","none").attr("x",-200).attr("y",function(){return ka/2});Ba.selectAll("rect.legend-item-event").data(c).transition().duration(f?250:0).attr("x",function(a,b){return d+Ua*
b});Ba.selectAll("rect.legend-item-tile").data(c).transition().duration(f?250:0).attr("x",function(a,b){return d+Ua*b});Ba.selectAll("text").data(c).transition().duration(f?250:0).attr("x",function(a,b){return d+Ua*b+14})}function Va(a){return u(a)?".target-"+a:".target"}function hc(a){return Cc(a.id)}function ic(a){return"data"in a&&Cc(a.data.id)}var h={data:{}},pb={},$="_expanded_",ga="_selected_",ec="_included_",sa=f(["bindto"],"#chart"),$a=f(["size","width"],null),pc=f(["size","height"],null),
ab=f(["padding","left"],null),cb=f(["padding","right"],null),oa=f(["zoom","enabled"],!1),jd=f(["zoom","extent"],null),ne=f(["zoom","privileged"],!1),he=f(["onenter"],function(){}),ie=f(["onleave"],function(){});if(!("data"in aa))throw Error("data is required in config");var na=f(["data","x"],null),Z=f(["data","xs"],null),Rb=f(["data","x_format"],"%Y-%m-%d"),Md=f(["data","id_converter"],function(a){return a}),Ka=f(["data","names"],{}),t=f(["data","groups"],[]),sc=f(["data","axes"],{}),Ac=f(["data",
"type"],null),C=f(["data","types"],{}),kd=f(["data","regions"],{}),Be=f(["data","colors"],{}),ea=f(["data","selection","enabled"],!1),pa=f(["data","selection","grouped"],!1),fa=f(["data","selection","isselectable"],function(){return!0}),Aa=f(["subchart","show"],!1),Ab=Aa?f(["subchart","size","height"],60):0,Ce=f(["color","pattern"],null),Ca=f(["legend","show"],!0),Ua=f(["legend","item","width"],80),Ae=f(["legend","item","onclick"],function(){}),ld=f(["axis","x","type"],"indexed"),Ha=f(["axis","x",
"categories"],[]),sd=f(["axis","x","tick","centered"],!1),lb=f(["axis","x","tick","format"],null),vb=f(["axis","x","default"],null),je=f(["axis","x","label"],null),Cd=f(["axis","y","max"],null),Ad=f(["axis","y","min"],null),Ed=f(["axis","y","center"],null),ke=f(["axis","y","label"],null),bb=f(["axis","y","inner"],!1),ee=f(["axis","y","tick","format"],function(a){return a}),Ia=f(["axis","y","padding"],null),de=f(["axis","y","ticks"],10),Bb=f(["axis","y2","show"],!1),Bd=f(["axis","y2","max"],null),
zd=f(["axis","y2","min"],null),Dd=f(["axis","y2","center"],null),db=f(["axis","y2","inner"],!1),ge=f(["axis","y2","tick","format"],function(a){return a}),Ja=f(["axis","y2","padding"],null),fe=f(["axis","y2","ticks"],10),g=f(["axis","rotated"],!1),bd=f(["grid","x","show"],!1),ue=f(["grid","x","type"],"tick"),Zb=f(["grid","x","lines"],null),cd=f(["grid","y","show"],!1),$b=f(["grid","y","lines"],null),Wb=f(["point","show"],!0)?f(["point","r"],2.5):0,le=f(["point","focus","line","enabled"],!0),ac=f(["point",
"focus","expand","enabled"],!0),bc=f(["point","focus","expand","r"],ac?4:Wb),Qa=f(["point","focus","select","r"],8),te=f(["point","onclick"],function(){}),$d=f(["point","onselected"],function(){}),ae=f(["point","onunselected"],function(){}),vd=f(["arc","label","format"],function(a,b){return(100*b).toFixed(1)+"%"}),me=f(["arc","title"],""),P=f(["regions"],[]),Pc=f(["tooltip","contents"],function(a){var b="<table class='-tooltip'><tr><th colspan='2'>"+mc()(a[0].x)+"</th></tr>",c,d,f;for(c=0;c<a.length;c++)a[c]&&
(a[c].value||0===a[c].value)&&(d=u(a[c].value)?(Math.round(100*a[c].value)/100).toFixed(2):"-",f=a[c].name,b+="<tr class='-tooltip-name-"+a[c].id+"'><td class='name'><span style='background-color:"+J(a[c].id)+"'></span>"+f+"</td><td class='value'>"+d+"</td></tr>");return b+"</table>"}),oe=f(["tooltip","init","show"],!1),Da=f(["tooltip","init","x"],0),ed=f(["tooltip","init","position"],{top:"0px",left:"50px"}),Yb=sa.replace("#","")+"-clip",Ra="url(#"+Yb+")",B="timeseries"===ld,da="categorized"===ld,
Ob=!B&&(na||Z),dc=null,Sa=!1,cc=!1,ka=Ca?40:0,J=function(a,b){var c=[],d=null!==b?b:"#1f77b4 #ff7f0e #2ca02c #d62728 #9467bd #8c564b #e377c2 #7f7f7f #bcbd22 #17becf".split(" ");return function(b){if(b in a)return a[b];-1===c.indexOf(b)&&c.push(b);return d[c.indexOf(b)%d.length]}}(Be,Ce),td=function(){var a=[[d.time.format("%Y/%-m/%-d"),function(){return!0}],[d.time.format("%-m/%-d"),function(a){return a.getMonth()}],[d.time.format("%-m/%-d"),function(a){return 1!==a.getDate()}],[d.time.format("%-m/%-d"),
function(a){return a.getDay()&&1!==a.getDate()}],[d.time.format("%I %p"),function(a){return a.getHours()}],[d.time.format("%I:%M"),function(a){return a.getMinutes()}],[d.time.format(":%S"),function(a){return a.getSeconds()}],[d.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)}}(),r,Cb,s,eb,zb,ra,Ga,Db,Eb,kb,qc,rc,Lb,Fb,Gb,Hb,Ib,Jb,Kb,m,z,Y,U,hb,ib,I,ua,jb,gb,od=g?"left":"bottom",pd=g?bb?"top":"bottom":bb?
"right":"left",qd=g?db?"bottom":"top":db?"left":"right",rd=g?"left":"bottom",L={main:function(){return"translate("+A+","+n+")"},context:function(){return"translate("+Fa+","+Ea+")"},legend:function(){return"translate("+kc+","+jc+")"},y2:function(){return"translate("+(g?0:r)+","+(g?10:0)+")"},x:function(){return"translate(0,"+s+")"},subx:function(){return"translate(0,"+(g?0:eb)+")"},arc:function(){return"translate("+r/2+","+s/2+")"}},oc=40,nc=20;Lb=d.layout.pie().value(function(a){return a.values.reduce(function(a,
c){return a+c.value},0)});var ve=function(){var a=d.svg.line().x(g?function(a){return w(a.id)(a.value)}:wa).y(g?wa:function(a){return w(a.id)(a.value)});return function(b){var c=Tb(b.values),d;if(Qb(b))return Sc(b)?a.interpolate("cardinal"):a.interpolate("linear"),kd[b.id]?ce(c,m,w(b.id),kd[b.id]):a(c);d=m(c[0].x);b=w(b.id)(c[0].value);return g?"M "+b+" "+d:"M "+d+" "+b}}(),we=function(){var a;a=g?d.svg.area().x0(function(a){return w(a.id)(0)}).x1(function(a){return w(a.id)(a.value)}).y(wa):d.svg.area().x(wa).y0(function(a){return w(a.id)(0)}).y1(function(a){return w(a.id)(a.value)});
return function(b){var c=Tb(b.values),d;if(la([b],"area")||la([b],"area-spline"))return Sc(b)?a.interpolate("cardinal"):a.interpolate("linear"),a(c);d=m(c[0].x);b=w(b.id)(c[0].value);return g?"M "+b+" "+d:"M "+d+" "+b}}(),xe=function(){var a=d.svg.line().x(g?function(a){return G(a.id)(a.value)}:Jc).y(g?Jc:function(a){return G(a.id)(a.value)});return function(b){var c=Tb(b.values);return Qb(b)?a(c):"M "+U(c[0].x)+" "+G(b.id)(c[0].value)}}(),K=d.svg.brush().on("brush",function(){H({withTransition:!1,
withY:!1,withSubchart:!1,withUpdateXDomain:!0})}),E=d.behavior.zoom().on("zoomstart",function(){E.altDomain=d.event.sourceEvent.altKey?m.orgDomain():null}).on("zoom",oa?ye:null);K.update=function(){F&&F.select(".x.brush").call(this);return this};K.scale=function(a){return g?this.y(a):this.x(a)};E.scale=function(a){return g?this.y(a):this.x(a)};E.orgScaleExtent=function(){var a=jd?jd:[1,10];return[a[0],Math.max(fb()/a[1],a[1])]};E.updateScaleExtent=function(){var a=ta(m.orgDomain())/ta(T),b=this.orgScaleExtent();
this.scaleExtent([b[0]*a,b[1]*a]);return this};var p,ub,l,F,Ba,V,tb,T;h.focus=function(a){var b=p.selectAll(Va(a)),c=b.filter(hc),b=b.filter(ic);h.revert();h.defocus();c.classed("focused",!0).transition().duration(100).style("opacity",1);b.transition().duration(100).style("opacity",1);D(h.data.targets)&&Za(a,!0);fc(a)};h.defocus=function(a){var b=p.selectAll(Va(a)),c=b.filter(hc),b=b.filter(ic);h.revert();c.classed("focused",!1).transition().duration(100).style("opacity",0.3);b.transition().duration(100).style("opacity",
0.3);D(h.data.targets)&&xb(a);ze(a)};h.revert=function(a){var b=p.selectAll(Va(a)),c=b.filter(hc),b=b.filter(ic);c.classed("focused",!1).transition().duration(100).style("opacity",1);b.transition().duration(100).style("opacity",1);D(h.data.targets)&&xb(a);gc()};h.show=function(a){p.selectAll(Va(a)).transition().style("opacity",1)};h.hide=function(a){p.selectAll(Va(a)).transition().style("opacity",0)};h.unzoom=function(){K.clear().update();H({withUpdateXDomain:!0})};h.load=function(a){"function"!==
typeof a.done&&(a.done=function(){});a.xs&&Ld(a.xs);"categories"in a&&da&&(Ha=a.categories,I.categories(Ha));if("cacheIds"in a&&Hd(a.cacheIds))Ta(Id(a.cacheIds),a.done);else if("data"in a)Ta(La(a.data),a.done);else if("url"in a)d.csv(a.url,function(b,c){Ta(La(c),a.done)});else if("rows"in a)Ta(La(yc(a.rows)),a.done);else if("columns"in a)Ta(La(zc(a.columns)),a.done);else throw Error("url or rows or columns is required.");};h.unload=function(a){h.data.targets=h.data.targets.filter(function(b){return b.id!==
a});p.selectAll(".target-"+a).transition().style("opacity",0).remove();Ca&&(p.selectAll(".legend-item-"+a).remove(),wb(h.data.targets));0<h.data.targets.length&&H({withUpdateOrgXDomain:!0,withUpdateXDomain:!0})};h.selected=function(a){a=u(a)?"-"+a:"";return d.merge(l.selectAll(".-shapes"+a).selectAll(".-shape").filter(function(){return d.select(this).classed(ga)}).map(function(a){return a.map(function(a){return a.__data__})}))};h.select=function(a,b,c){ea&&l.selectAll(".-shapes").selectAll(".-shape").each(function(e,
f){var g="circle"===this.nodeName?Xc:be,h="circle"===this.nodeName?Sb:Zc;0<=b.indexOf(f)?fa(e)&&(pa||x(a)||0<=a.indexOf(e.id))&&g(d.select(this).classed(ga,!0),e,f):u(c)&&c&&h(d.select(this).classed(ga,!1),e,f)})};h.unselect=function(a,b){ea&&l.selectAll(".-shapes").selectAll(".-shape").each(function(c,e){var f="circle"===this.nodeName?Sb:Zc;(x(b)||0<=b.indexOf(e))&&fa(c)&&(pa||x(a)||0<=a.indexOf(c.id))&&f(d.select(this).classed(ga,!1),c,e)})};h.toLine=function(a){Ma(a,"line");H()};h.toSpline=function(a){Ma(a,
"spline");H()};h.toBar=function(a){Ma(a,"bar");H()};h.toScatter=function(a){Ma(a,"scatter");H()};h.groups=function(a){if(x(a))return t;t=a;H();return t};h.regions=function(a){if(x(a))return P;P=a;H();return P};h.regions.add=function(a){if(x(a))return P;P=P.concat(a);H();return P};h.regions.remove=function(a,b){var c=[].concat(a);b=u(b)?b:{};c.forEach(function(a){var c=p.selectAll("."+a);u(b.duration)&&(c=c.transition().duration(b.duration).style("fill-opacity",0));c.remove();P=P.filter(function(b){return 0>
b.classes.indexOf(a)})});return P};h.data.get=function(a){a=h.data.getAsTarget(a);return u(a)?a.values.map(function(a){return a.value}):void 0};h.data.getAsTarget=function(a){var b=nb(function(b){return b.id===a});return 0<b.length?b[0]:void 0};h.destroy=function(){h.data.targets=void 0;h.data.x={};tb.html("");O.onresize=null};if("url"in aa.data)d.csv(aa.data.url,function(a,b){Xb(b)});else if("rows"in aa.data)Xb(yc(aa.data.rows));else if("columns"in aa.data)Xb(zc(aa.data.columns));else throw Error("url or rows or columns is required.");
return h}})(window);

4
htdocs/samples/dount.html

@ -26,7 +26,6 @@
// ["versicolor", 40],
// ["virginica", 50],
],
// type : 'pie',
type : 'dount',
},
axis: {
@ -40,7 +39,8 @@
arc: {
label: {
format: function (d, ratio) { return ""; }
}
},
title: "Iris Petal Width"
}
});

Loading…
Cancel
Save