Browse Source

Fix transition

pull/34/merge 0.1.10
Masayuki Tanaka 11 years ago
parent
commit
d2ea233840
  1. 220
      c3.js
  2. 177
      c3.min.js

220
c3.js

@ -241,9 +241,13 @@
};
height3 = currentHeight - margin3.top - margin3.bottom;
// for arc
updateRadius();
}
function updateRadius() {
radiusExpanded = height / 2;
radius = radiusExpanded * 0.95;
innerRadius = hasDountType(c3.data.targets) ? radius * 0.6 : 0;
innerRadius = hasDonutType(c3.data.targets) ? radius * 0.6 : 0;
}
function getCurrentWidth() {
return __size_width === null ? getParentWidth() : __size_width;
@ -321,11 +325,13 @@
yAxis2 = getYAxis(y2, y2Orient);
subXAxis = getXAxis(subX, subXOrient);
// update for arc
updateArc();
}
function updateArc() {
svgArc = getSvgArc();
svgArcExpanded = getSvgArcExpanded();
svgArcExpandedSub = getSvgArcExpanded(0.98);
}
function getX(min, max, domain, offset) {
var scale = ((isTimeSeries) ? d3.time.scale() : d3.scale.linear()).range([min, max]);
// Set function and values for c3
@ -459,7 +465,7 @@
.transition().duration(100)
.attr("d", svgArcExpandedSub)
.each(function (d) {
if (isDountType(d.data)) {
if (isDonutType(d.data)) {
// callback here
}
});
@ -1033,6 +1039,7 @@
var targetIds = isUndefined(targets) ? getTargetIds() : targets;
if (typeof targetIds === 'string') { targetIds = [targetIds]; }
for (var i = 0; i < targetIds.length; i++) {
withoutFadeIn[targetIds[i]] = (type === __data_types[targetIds[i]]);
__data_types[targetIds[i]] = type;
}
}
@ -1044,6 +1051,10 @@
});
return has;
}
function initialOpacity(d) {
return withoutFadeIn[d.id] ? 1 : 0;
}
/* not used
function hasLineType(targets) {
return hasType(targets, 'line');
@ -1058,11 +1069,11 @@
function hasPieType(targets) {
return hasType(targets, 'pie');
}
function hasDountType(targets) {
return hasType(targets, 'dount');
function hasDonutType(targets) {
return hasType(targets, 'donut');
}
function hasArcType(targets) {
return hasPieType(targets) || hasDountType(targets);
return hasPieType(targets) || hasDonutType(targets);
}
function isLineType(d) {
var id = (typeof d === 'string') ? d : d.id;
@ -1084,12 +1095,12 @@
var id = (typeof d === 'string') ? d : d.id;
return __data_types[id] === 'pie';
}
function isDountType(d) {
function isDonutType(d) {
var id = (typeof d === 'string') ? d : d.id;
return __data_types[id] === 'dount';
return __data_types[id] === 'donut';
}
function isArcType(d) {
return isPieType(d) || isDountType(d);
return isPieType(d) || isDonutType(d);
}
/* not used
function lineData(d) {
@ -1280,6 +1291,41 @@
};
})();
var drawBar = function (barIndices, isSub_) {
var barTargetsNum = barIndices.__max__ + 1,
isSub = arguments.length > 1 ? isSub_ : true,
barW = getBarW(xAxis, barTargetsNum, !!isSub),
x = getBarX(barW, barTargetsNum, barIndices, !!isSub),
y = getBarY(!!isSub),
barOffset = getBarOffset(barIndices, !!isSub),
yScale = isSub ? getSubYScale : getYScale;
return function (d, i) {
var y0 = yScale(d.id)(0),
offset = barOffset(d, i) || y0; // offset is for stacked bar chart
// 4 points that make a bar
var points = [
[x(d), offset],
[x(d), y(d) - (y0 - offset)],
[x(d) + barW, y(d) - (y0 - offset)],
[x(d) + barW, offset]
];
// switch points if axis is rotated, not applicable for sub chart
var indexX = __axis_rotated ? 1 : 0;
var indexY = __axis_rotated ? 0 : 1;
var path = 'M ' + points[0][indexX] + ',' + points[0][indexY] + ' ' +
'L' + points[1][indexX] + ',' + points[1][indexY] + ' ' +
'L' + points[2][indexX] + ',' + points[2][indexY] + ' ' +
'L' + points[3][indexX] + ',' + points[3][indexY] + ' ' +
'z';
return path;
};
};
// For brush region
var lineOnSub = (function () {
var line = d3.svg.line()
@ -1394,6 +1440,9 @@
// for brush area culculation
var orgXDomain;
// for save value
var orgAreaOpacity, withoutFadeIn = {};
function init(data) {
var eventRect, grid, xgridLines, ygridLines;
var i;
@ -1662,7 +1711,7 @@
updateTargets(c3.data.targets);
// Draw with targets
redraw({withTransition: false, withUpdateXDomain: true});
redraw({withTransform: true, withUpdateXDomain: true});
// Show tooltip if needed
if (__tooltip_init_show) {
@ -1954,9 +2003,9 @@
function redraw(options) {
var xgrid, xgridData, xgridLines, ygrid, ygridLines;
var mainCircle, mainBar, mainRegion, contextBar, eventRectUpdate;
var barIndices = getBarIndices(), barTargetsNum = barIndices.__max__ + 1, maxDataCountTarget;
var barIndices = getBarIndices(), maxDataCountTarget;
var rectX, rectW;
var withY, withSubchart, withTransition, withUpdateXDomain, withUpdateOrgXDomain;
var withY, withSubchart, withTransition, withTransform, withUpdateXDomain, withUpdateOrgXDomain;
var hideAxis = hasArcType(c3.data.targets);
var duration;
@ -1964,10 +2013,11 @@
withY = isDefined(options.withY) ? options.withY : true;
withSubchart = isDefined(options.withSubchart) ? options.withSubchart : true;
withTransition = isDefined(options.withTransition) ? options.withTransition : true;
withTransform = isDefined(options.withTransform) ? options.withTransform : false;
withUpdateXDomain = isDefined(options.withUpdateXDomain) ? options.withUpdateXDomain : false;
withUpdateOrgXDomain = isDefined(options.withUpdateOrgXDomain) ? options.withUpdateOrgXDomain : false;
duration = withTransition ? 250 : 0;
duration = withTransition ? 350 : 0;
if (withUpdateOrgXDomain) {
x.domain(d3.extent(getXDomain(c3.data.targets)));
@ -1986,9 +2036,9 @@
y2.domain(getYDomain('y2'));
// axis
main.select(".x.axis").transition().duration(__axis_rotated ? duration : 0).call(__axis_rotated ? yAxis : xAxis).style("opacity", hideAxis ? 0 : 1);
main.select(".y.axis").transition().duration(__axis_rotated ? 0 : duration).call(__axis_rotated ? xAxis : yAxis).style("opacity", hideAxis ? 0 : 1);
main.select(".y2.axis").transition().call(yAxis2).style("opacity", hideAxis ? 0 : 1);
main.select(".x.axis").style("opacity", hideAxis ? 0 : 1).transition().duration(__axis_rotated ? duration : 0).call(__axis_rotated ? yAxis : xAxis);
main.select(".y.axis").style("opacity", hideAxis ? 0 : 1).transition().duration(__axis_rotated ? 0 : duration).call(__axis_rotated ? xAxis : yAxis);
main.select(".y2.axis").style("opacity", hideAxis ? 0 : 1).transition().call(yAxis2);
// Update label position
main.select(".x.axis .-axis-x-label").attr("x", width);
@ -2065,72 +2115,43 @@
}
// bars
var drawBar = function (isSub) {
var barW = getBarW(xAxis, barTargetsNum, !!isSub),
x = getBarX(barW, barTargetsNum, barIndices, !!isSub),
y = getBarY(!!isSub),
barOffset = getBarOffset(barIndices, !!isSub),
yScale = isSub ? getSubYScale : getYScale;
return function (d, i) {
var y0 = yScale(d.id)(0),
offset = barOffset(d, i) || y0; // offset is for stacked bar chart
// 4 points that make a bar
var points = [
[x(d), offset],
[x(d), y(d) - (y0 - offset)],
[x(d) + barW, y(d) - (y0 - offset)],
[x(d) + barW, offset]
];
// switch points if axis is rotated, not applicable for sub chart
var indexX = __axis_rotated ? 1 : 0;
var indexY = __axis_rotated ? 0 : 1;
var path = 'M ' + points[0][indexX] + ',' + points[0][indexY] + ' ' +
'L' + points[1][indexX] + ',' + points[1][indexY] + ' ' +
'L' + points[2][indexX] + ',' + points[2][indexY] + ' ' +
'L' + points[3][indexX] + ',' + points[3][indexY] + ' ' +
'z';
return path;
};
};
mainBar = main.selectAll('.-bars').selectAll('.-bar')
.data(barData);
mainBar.enter().append('path')
.attr('d', drawBar(false))
.attr('d', drawBar(barIndices, false))
.style("stroke", 'none')
.style("opacity", 0)
.style("fill", function (d) { return color(d.id); })
.attr("class", classBar);
mainBar
.transition().duration(duration)
.attr('d', drawBar(false))
.style("opacity", initialOpacity)
.transition().duration(duration)
.attr('d', drawBar(barIndices, false))
.style("opacity", 1);
mainBar.exit().transition().duration(duration)
.style('opacity', 0)
.remove();
// lines and cricles
main.selectAll('.chart-line').select('.-line')
main.selectAll('.-line')
.style("opacity", initialOpacity)
.transition().duration(duration)
.attr("d", lineOnMain);
.attr("d", lineOnMain)
.style("opacity", 1);
main.selectAll('.-area')
.transition().duration(duration)
.attr("d", areaOnMain);
.style("opacity", 0)
.transition().duration(duration)
.attr("d", areaOnMain)
.style("opacity", orgAreaOpacity);
mainCircle = main.selectAll('.-circles').selectAll('.-circle')
.data(lineOrScatterData);
mainCircle.enter().append("circle")
.attr("class", classCircle)
.style('opacity', 0)
.attr("r", __point_r);
mainCircle.transition().duration(duration)
mainCircle
.style("opacity", initialOpacity)
.transition().duration(duration)
.style('opacity', opacityCircle)
.attr("cx", __axis_rotated ? circleY : circleX)
.attr("cy", __axis_rotated ? circleX : circleY);
@ -2138,6 +2159,7 @@
// arc
main.selectAll('.chart-arc').select('.-arc')
.attr("transform", withTransform ? "scale(0)" : "")
.style("opacity", function (d) { return d === this._current ? 0 : 1; })
.transition().duration(duration)
.attrTween("d", function (d) {
@ -2157,13 +2179,16 @@
this._current = i(0);
return function (t) { return getArc(i(t), true); };
})
.attr("transform", withTransform ? "scale(1)" : "")
.style("opacity", 1);
main.selectAll('.chart-arc').select('text')
.attr("transform", transformForArcLable)
.attr("opacity", 0)
.style("opacity", 0)
.transition().duration(duration)
.text(textForArcLable)
.attr("opacity", function (d) { return isArcType(d.data) ? 1 : 0; });
.style("opacity", function (d) { return isArcType(d.data) ? 1 : 0; });
main.select('.chart-arcs-title')
.style("opacity", hasDonutType(c3.data.targets) ? 1 : 0);
// subchart
if (__subchart_show) {
@ -2174,7 +2199,7 @@
// update subchart elements if needed
if (withSubchart) {
// axes
context.select('.x.axis').transition().duration(__axis_rotated ? duration : 0).call(subXAxis);
context.select('.x.axis').style("opacity", hideAxis ? 0 : 1).transition().duration(__axis_rotated ? duration : 0).call(subXAxis);
// extent rect
if (!brush.empty()) {
brush.extent(x.orgDomain()).update();
@ -2183,22 +2208,24 @@
contextBar = context.selectAll('.-bars').selectAll('.-bar')
.data(barData);
contextBar.enter().append('path')
.attr('d', drawBar(true))
.attr('d', drawBar(barIndices))
.style("stroke", 'none')
.style("fill", function (d) { return color(d.id); })
.attr("class", classBar);
contextBar
.style("opacity", 0)
.transition().duration(duration)
.attr('d', drawBar(true))
.style("opacity", initialOpacity)
.transition().duration(duration)
.attr('d', drawBar(barIndices))
.style('opacity', 1);
contextBar.exit().transition().duration(duration)
.style('opacity', 0)
.remove();
// lines
context.selectAll('.-line')
.transition().duration(duration)
.attr("d", lineOnSub);
.style("opacity", initialOpacity)
.transition().duration(duration)
.attr("d", lineOnSub)
.style('opacity', 1);
}
}
@ -2273,6 +2300,11 @@
mainRegion.exit().transition().duration(duration)
.style("fill-opacity", 0)
.remove();
// update fadein condition
getTargetIds().forEach(function (id) {
withoutFadeIn[id] = true;
});
}
function redrawForBrush() {
redraw({
@ -2356,14 +2388,12 @@
.data(targets);
mainBarEnter = mainBarUpdate.enter().append('g')
.attr('class', function (d) { return 'chart-bar target target-' + d.id; })
.style("pointer-events", "none")
.style('opacity', 0);
.style("pointer-events", "none");
// Bars for each data
mainBarEnter.append('g')
.attr("class", classBars)
.style("fill", function (d) { return color(d.id); })
.style("stroke", function (d) { return color(d.id); })
.style("stroke-width", 0)
.style("stroke", "none")
.style("cursor", function (d) { return __data_selection_isselectable(d) ? "pointer" : null; });
//-- Line --//
@ -2372,15 +2402,16 @@
.data(targets);
mainLineEnter = mainLineUpdate.enter().append('g')
.attr('class', function (d) { return 'chart-line target target-' + d.id; })
.style("pointer-events", "none")
.style('opacity', 0);
.style("pointer-events", "none");
// Lines for each data
mainLineEnter.append("path")
.attr("class", classLine)
.style("opacity", 0)
.style("stroke", function (d) { return color(d.id); });
// Areas
mainLineEnter.append("path")
.attr("class", classArea)
.style("opacity", function () { orgAreaOpacity = +d3.select(this).style('opacity'); return 0; })
.style("fill", function (d) { return color(d.id); });
// Circles for each data point on lines
mainLineEnter.append('g')
@ -2399,15 +2430,14 @@
//mainLineUpdate.exit().remove();
//-- Pie --//
mainPieUpdate = main.select('.chart-arcs')
.selectAll(".chart-arc")
.data(pie(targets));
mainPieEnter = mainPieUpdate.enter().append("g")
.attr("class", function (d) { return 'chart-arc target target-' + d.data.id; })
.style('opacity', 0);
.attr("class", function (d) { return 'chart-arc target target-' + d.data.id; });
mainPieEnter.append("path")
.attr("class", classArc)
.style("opacity", 0)
.style("fill", function (d) { return color(d.data.id); })
.style("cursor", function (d) { return __data_selection_isselectable(d) ? "pointer" : null; })
.each(function (d) { this._current = d; })
@ -2421,6 +2451,7 @@
});
mainPieEnter.append("text")
.attr("dy", ".35em")
.style("opacity", 0)
.style("text-anchor", "middle")
.style("pointer-events", "none");
// MEMO: can not keep same color..., but not bad to update color in redraw
@ -2434,8 +2465,7 @@
.selectAll('.chart-bar')
.data(targets);
contextBarEnter = contextBarUpdate.enter().append('g')
.attr('class', function (d) { return 'chart-bar target target-' + d.id; })
.style('opacity', 0);
.attr('class', function (d) { return 'chart-bar target target-' + d.id; });
// Bars for each data
contextBarEnter.append('g')
.attr("class", classBars)
@ -2446,11 +2476,11 @@
.selectAll('.chart-line')
.data(targets);
contextLineEnter = contextLineUpdate.enter().append('g')
.attr('class', function (d) { return 'chart-line target target-' + d.id; })
.style('opacity', 0);
.attr('class', function (d) { return 'chart-line target target-' + d.id; });
// Lines for each data
contextLineEnter.append("path")
.attr("class", classLine)
.style("opacity", 0)
.style("stroke", function (d) { return color(d.id); });
}
@ -2766,6 +2796,30 @@
redraw();
};
c3.toArea = function (targets) {
setTargetType(targets, 'area');
redraw();
};
c3.toAreaSpline = function (targets) {
setTargetType(targets, 'area-spline');
redraw();
};
c3.toPie = function (targets) {
setTargetType(targets, 'pie');
updateRadius();
updateArc();
redraw({withTransform: true});
};
c3.toDonut = function (targets) {
setTargetType(targets, 'donut');
updateRadius();
updateArc();
redraw({withTransform: true});
};
c3.groups = function (groups) {
if (isUndefined(groups)) { return __data_groups; }
__data_groups = groups;

177
c3.min.js vendored

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

Loading…
Cancel
Save