From 5f100cb8947a7fbe0660ac31d775339838820291 Mon Sep 17 00:00:00 2001 From: Masayuki Tanaka Date: Fri, 23 May 2014 20:33:04 +0900 Subject: [PATCH] Fix legend item width - #257 --- c3.js | 2 +- c3.min.js | 2 +- htdocs/samples/legend.html | 61 ++++++++++++++++++++++++++++++++++++++ 3 files changed, 63 insertions(+), 2 deletions(-) create mode 100644 htdocs/samples/legend.html diff --git a/c3.js b/c3.js index 2bfb7c5..dc3c7af 100644 --- a/c3.js +++ b/c3.js @@ -4206,7 +4206,7 @@ function updateLegend(targetIds, options, transitions) { var xForLegend, xForLegendText, xForLegendRect, yForLegend, yForLegendText, yForLegendRect; - var paddingTop = 4, paddingRight = 26, maxWidth = 0, maxHeight = 0, posMin = 10; + var paddingTop = 4, paddingRight = 36, maxWidth = 0, maxHeight = 0, posMin = 10; var l, totalLength = 0, offsets = {}, widths = {}, heights = {}, margins = [0], steps = {}, step = 0; var withTransition, withTransitionForTransform; var hasFocused = legend.selectAll('.' + CLASS.legendItemFocused).size(); diff --git a/c3.min.js b/c3.min.js index d9d69c9..4066f34 100644 --- a/c3.min.js +++ b/c3.min.js @@ -1,3 +1,3 @@ !function(a){"use strict";function b(a){return a||0===a}function c(a){return"undefined"==typeof a}function d(a){return"undefined"!=typeof a}function e(a,b){function c(a,b){a.attr("transform",function(a){return"translate("+Math.ceil(b(a)+s)+", 0)"})}function d(a,b){a.attr("transform",function(a){return"translate(0,"+Math.ceil(b(a))+")"})}function e(a){var b=a[0],c=a[a.length-1];return c>b?[b,c]:[c,b]}function f(a){var b,c,d=[];if(a.ticks)return a.ticks.apply(a,k);for(c=a.domain(),b=Math.ceil(c[0]);b0&&d[0]>0&&d.unshift(d[0]-(d[1]-d[0])),d}function g(){var a,c=m.copy();return b&&(a=m.domain(),c.domain([a[0],a[1]-1])),c}function h(a){var c=b&&a=0;return"url("+(c?"":document.URL.split("#")[0])+"#"+b+")"}function k(a){return Math.ceil(a)+.5}function l(a,b){var c,d,e;b&&b.axisX?c=b.axisX:(c=Xj.select("."+g.axisX),a&&(c=c.transition())),b&&b.axisY?d=b.axisY:(d=Xj.select("."+g.axisY),a&&(d=d.transition())),b&&b.axisY2?e=b.axisY2:(e=Xj.select("."+g.axisY2),a&&(e=e.transition())),Xj.attr("transform",Kj.main),c.attr("transform",Kj.x),d.attr("transform",Kj.y),e.attr("transform",Kj.y2),Xj.select("."+g.chartArcs).attr("transform",Kj.arc)}function m(a,b){var c;b&&b.axisSubX?c=b.axisSubX:(c=Yj.select("."+g.axisX),a&&(c=c.transition())),Yj.attr("transform",Kj.context),c.attr("transform",Kj.subx)}function n(a){(a?Zj.transition():Zj).attr("transform",Kj.legend)}function o(a,b){l(a,b),Ah&&m(a,b),n(a)}function p(){var a=V(),b=U(),c=Lj?0:a,d=ne($f.data.targets),e=Kh||d?0:A("x"),f=Ah&&!d?Bh+e:0;xg=t(),yg=u(),Kh?(qg={top:A("y2")+v(),right:d?0:y(),bottom:A("y")+c+w(),left:f+(d?0:x())},rg={top:qg.top,right:0/0,bottom:20+c,left:Qj}):(qg={top:4+v(),right:d?0:y(),bottom:e+f+c+w(),left:d?0:x()},rg={top:yg-f-c,right:0/0,bottom:e+c,left:qg.left}),sg={top:Lj?0:yg-a,right:0/0,bottom:0,left:Lj?xg-b:0},tg=xg-qg.left-qg.right,vg=yg-qg.top-qg.bottom,0>tg&&(tg=0),0>vg&&(vg=0),ug=Kh?qg.left-Qj-Rj:tg,wg=Kh?vg:yg-rg.top-rg.bottom,0>ug&&(ug=0),0>wg&&(wg=0),Cg=tg-(Lj?b+10:0),Dg=vg-(Lj?0:10),r(),Lj&&d&&(sg.left=Cg/2+1.1*Ag)}function q(){Xj.select("line."+g.xgridFocus).attr("x1",Kh?0:-10).attr("x2",Kh?tg:-10).attr("y1",Kh?-10:qg.top).attr("y2",Kh?-10:vg)}function r(){var a;Ag=Math.min(Cg,Dg)/2,zg=.95*Ag,a=Wi?(zg-Wi)/zg:.6,Bg=me($f.data.targets)||le($f.data.targets)?zg*a:0}function s(){var a=Kh?g.axisX:g.axisY,b=Xj.select("."+a).node(),c=b?b.getBoundingClientRect():{right:0},d=_j.node().getBoundingClientRect(),e=ne($f.data.targets),f=c.right-d.left-(e?0:x());return f>0?f:0}function t(){return bg?bg:C()}function u(){var a=cg?cg:D();return a>0?a:320}function v(){return fg?fg:0}function w(){return gg?gg:0}function x(){return dg?dg:Kh?Lh?Math.max(Qe(z("x")),40):1:!bi||gi?1:Qe(z("y"))}function y(){var a=10,b=Lj?U()+20:0;return eg?eg:Kh?a+b:(!ki||pi?a:Qe(z("y2")))+b}function z(a){var b=pb(a);return b.isInner?20+Ib(a):40+Ib(a)}function A(a){return"x"!==a||Lh?"x"===a&&$h?$h:"y"!==a||bi?"y2"!==a||ki?(pb(a).isInner?30:40)+("y2"===a?-10:0):Sj:Eh&&!Lj?10:1:0}function B(a){for(var b,c=_j.node();c&&"BODY"!==c.tagName&&!(b=c.getBoundingClientRect()[a]);)c=c.parentNode;return b}function C(){return B("width")}function D(){var a=_j.style("height");return a.indexOf("px")>0?+a.replace("px",""):0}function E(a){return a?-31:-(qg.left-1)}function F(a){return a?-20:-4}function G(){return E(!Kh)}function H(){return F(!Kh)}function I(){return E(Kh)}function J(){return F(Kh)}function K(a){return a?tg+2+30+30:qg.left+20}function L(a){return a?($h?$h:0)+80:vg+8}function M(){return K(!Kh)}function N(){return L(!Kh)}function O(){return K(Kh)}function P(){return L(Kh)}function Q(){var a,b,c,d,e,f,g=Fc($f.data.targets);return g?(a=g.values[0],b=g.values[g.values.length-1],c=Qg(b.x)-Qg(a.x),0===c?Kh?vg:tg:(d=Ec(),e=ie($f.data.targets)?(d-(rj?.25:1))/d:1,f=d>1?c*e/(d-1):c,1>f?1:f)):0}function R(a){Mj=a}function S(a){Nj=a}function T(a){Oj=a}function U(){return Eh?Lj?Nj*(Mj+1):xg:0}function V(){return Eh?Lj?yg:Oj*(Mj+1):0}function W(){var a,b,c=!Qg;Ig=Kh?1:0,Jg=Kh?vg:tg,Kg=Kh?0:vg,Lg=Kh?tg:1,Mg=Ig,Ng=Jg,Og=Kh?0:wg,Pg=Kh?ug:1,Qg=Z(Ig,Jg,c?void 0:Qg.domain(),function(){return Wg.tickOffset()}),Rg=$(Kg,Lg,c?void 0:Rg.domain()),Sg=$(Kg,Lg,c?void 0:Sg.domain()),Tg=Z(Ig,Jg,ak,function(a){return a%1?0:Zg.tickOffset()}),Ug=$(Og,Pg,c?void 0:Ug.domain()),Vg=$(Og,Pg,c?void 0:Vg.domain()),a=eb(),b=Vh?Vh:c?void 0:Wg.tickValues(),Wg=bb(Qg,Gj,a,b),Zg=bb(Tg,Jj,a,b),Xg=cb(Rg,Hj,hi,ji),Yg=cb(Sg,Ij,qi,si),c||(Tj.scale(Tg),hg&&Uj.scale(Qg)),X()}function X(){Eg=Lb(),Fg=Mb(),Gg=Mb(.98)}function Y(a,b,c){return(c?Zf.time.scale():Zf.scale.linear()).range([a,b])}function Z(a,b,c,d){var e,f=Y(a,b,qj),g=c?f.domain(c):f;rj?(d=d||function(){return 0},f=function(a,b){var c=g(a)+d(a);return b?c:Math.ceil(c)}):f=function(a,b){var c=g(a);return b?c:Math.ceil(c)};for(e in g)f[e]=g[e];return f.orgDomain=function(){var a=g.domain();return ak&&ak[0]===a[0]&&ak[1]a?a.toFixed(0):a};return Qh&&("function"==typeof Qh?a=Qh:qj&&(a=function(a){return a?Bj(Qh)(a):""})),a}function fb(a){var b;return"y"===a?b=fi:"y2"===a?b=oi:"x"===a&&(b=ai),b}function gb(a){var b=fb(a);return"string"==typeof b?b:b?b.text:null}function hb(a,b){var c=fb(a);"string"==typeof c?"y"===a?fi=b:"y2"===a?oi=b:"x"===a&&(ai=b):c&&(c.text=b)}function ib(a){return 10*Math.sin(Math.PI*(a/180))}function jb(a){return 11.5-2.5*(a/15)}function kb(a,b,c){a.selectAll(".tick text").style("text-anchor","start"),b.selectAll(".tick text").attr("y",jb(c)).attr("x",ib(c)).attr("transform","rotate("+c+")")}function lb(a,b){var c=fb(a),d=c&&"object"==typeof c&&c.position?c.position:b;return{isInner:d.indexOf("inner")>=0,isOuter:d.indexOf("outer")>=0,isLeft:d.indexOf("left")>=0,isCenter:d.indexOf("center")>=0,isRight:d.indexOf("right")>=0,isTop:d.indexOf("top")>=0,isMiddle:d.indexOf("middle")>=0,isBottom:d.indexOf("bottom")>=0}}function mb(){return lb("x",Kh?"inner-top":"inner-right")}function nb(){return lb("y",Kh?"inner-right":"inner-top")}function ob(){return lb("y2",Kh?"inner-right":"inner-top")}function pb(a){return"y2"===a?ob():"y"===a?nb():mb()}function qb(){return gb("x")}function rb(){return gb("y")}function sb(){return gb("y2")}function tb(a,b){return a?b.isLeft?0:b.isCenter?tg/2:tg:b.isBottom?-vg:b.isMiddle?-vg/2:0}function ub(a,b){return a?b.isLeft?"0.5em":b.isRight?"-0.5em":"0":b.isTop?"-0.5em":b.isBottom?"0.5em":"0"}function vb(a,b){return a?b.isLeft?"start":b.isCenter?"middle":"end":b.isBottom?"start":b.isMiddle?"middle":"end"}function wb(){return tb(!Kh,mb())}function xb(){return tb(Kh,nb())}function yb(){return tb(Kh,ob())}function zb(){return ub(!Kh,mb())}function Ab(){return ub(Kh,nb())}function Bb(){return ub(Kh,ob())}function Cb(){var a=mb();return Kh?a.isInner?"1.2em":-25-Ib("x"):a.isInner?"-0.5em":$h?$h-10:"3em"}function Db(){var a=nb();return Kh?a.isInner?"-0.5em":"3em":a.isInner?"1.2em":-20-Ib("y")}function Eb(){var a=ob();return Kh?a.isInner?"1.2em":"-2.2em":a.isInner?"-0.5em":30+Ib("y2")}function Fb(){return vb(!Kh,mb())}function Gb(){return vb(Kh,nb())}function Hb(){return vb(Kh,ob())}function Ib(a){var b=0,c="x"===a?g.axisX:"y"===a?g.axisY:g.axisY2;return Zf.selectAll("."+c+" .tick text").each(function(){var a=this.getBoundingClientRect();bb?0:b}function Jb(a){var b=Xj.select("."+g.axisX+" ."+g.axisXLabel),c=Xj.select("."+g.axisY+" ."+g.axisYLabel),d=Xj.select("."+g.axisY2+" ."+g.axisY2Label);(a?b.transition():b).attr("x",wb).attr("dx",zb).attr("dy",Cb).text(qb),(a?c.transition():c).attr("x",xb).attr("dx",Ab).attr("dy",Db).attr("dy",Db).text(rb),(a?d.transition():d).attr("x",yb).attr("dx",Bb).attr("dy",Eb).text(sb)}function Kb(a){var b=!1;if(Hg(Mc($f.data.targets)).forEach(function(c){b||c.data.id!==a.data.id||(b=!0,a=c)}),isNaN(a.endAngle)&&(a.endAngle=a.startAngle),ve(a.data)){var c=Qi,d=Ri,e=Math.abs(c)+d,f=Math.PI/e;a.startAngle=-1*(Math.PI/2)+f*Math.abs(c),a.endAngle=a.startAngle+f*(a.value>d?d:a.value)}return b?a:null}function Lb(){var a=Zf.svg.arc().outerRadius(zg).innerRadius(Bg),b=function(b,c){var d;return c?a(b):(d=Kb(b),d?a(d):"M 0 0")};return b.centroid=a.centroid,b}function Mb(a){var b=Zf.svg.arc().outerRadius(Ag*(a?a:1)).innerRadius(Bg);return function(a){var c=Kb(a);return c?b(c):"M 0 0"}}function Nb(a,b,c){return c||xe(a.data)?Eg(a,b):"M 0 0"}function Ob(a){var b,c,d,e,f,g=Kb(a),h="";return g&&!le($f.data.targets)&&(b=Eg.centroid(g),c=b[0],d=b[1],e=Math.sqrt(c*c+d*d),f=(36/zg>.375?1.175-36/zg:.8)*zg/e,h="translate("+c*f+","+d*f+")"),h}function Pb(a){var b=le($f.data.targets)?Math.PI:2*Math.PI;return a?(a.endAngle-a.startAngle)/b:null}function Qb(a){return uc({id:a.data.id,value:a.value,ratio:Pb(a)})}function Rb(a){var b,c,d,e;return Ub()?(b=Kb(a),c=b?b.value:null,d=Pb(b),e=Vb(),e?e(c,d):Hd(c,d)):""}function Sb(a,b){var c=Vj.selectAll("."+g.chartArc+td(a)),d=Vj.selectAll("."+g.arc).filter(function(b){return b.data.id!==a});De(a)&&c.selectAll("path").transition().duration(50).attr("d",Fg).transition().duration(100).attr("d",Gg).each(function(a){we(a.data)}),b||d.style("opacity",.3)}function Tb(a){var b=Vj.selectAll("."+g.chartArc+td(a));b.selectAll("path."+g.arc).transition().duration(50).attr("d",Eg),Vj.selectAll("."+g.arc).style("opacity",1)}function Ub(){var a=!0;return me($f.data.targets)?a=Xi:ke($f.data.targets)&&(a=Ii),a}function Vb(){var a=Ji;return le($f.data.targets)?a=Pi:me($f.data.targets)&&(a=Yi),a}function Wb(){return me($f.data.targets)?$i:""}function Xb(){var a=Li;return le($f.data.targets)?a=Si:me($f.data.targets)&&(a=_i),"function"==typeof a?a:function(){}}function Yb(){var a=Mi;return le($f.data.targets)?a=Ti:me($f.data.targets)&&(a=aj),"function"==typeof a?a:function(){}}function Zb(){var a=Ni;return le($f.data.targets)?a=Ui:me($f.data.targets)&&(a=bj),"function"==typeof a?a:function(){}}function $b(a){var b,c,d,e,f,g,h=Hc(a),i=Tc(a);if(eh.length>0)for(g=Vc(a),b=0;b=0}),0!==e.length)for(d=e[0],g&&i[d]&&i[d].forEach(function(a,b){i[d][b]=0>a?a:0}),c=1;c0||(i[d][b]+=+a)});return Zf.min(Object.keys(i).map(function(a){return Zf.min(i[a])}))}function _b(a){var b,c,d,e,f,g,h=Hc(a),i=Tc(a);if(eh.length>0)for(g=Wc(a),b=0;b=0}),0!==e.length)for(d=e[0],g&&i[d]&&i[d].forEach(function(a,b){i[d][b]=a>0?a:0}),c=1;c+a||(i[d][b]+=+a)});return Zf.max(Object.keys(i).map(function(a){return Zf.max(i[a])}))}function ac(a,c){var d,e,f,g,h,i,j,k,l=a.filter(function(a){return db(a.id)===c}),m="y2"===c?mi:di,n="y2"===c?li:ci,o=b(m)?m:$b(l),p=b(n)?n:_b(l),q="y2"===c?ni:ei,r=Bd()&&Kh;return 0===l.length?"y2"===c?Sg.domain():Rg.domain():(o===p&&(0>o?p=0:o=0),d=Math.abs(p-o),e=f=g=r?0:.1*d,q&&(h=Math.max(Math.abs(o),Math.abs(p)),p=h-q,o=q-h),r&&(i=Cd(o,p),j=fc(Rg.range()),k=[i[0]/j,i[1]/j],f+=d*(k[1]/(1-k[0]-k[1])),g+=d*(k[0]/(1-k[0]-k[1]))),"y"===c&&ii&&(f=b(ii.top)?ii.top:e,g=b(ii.bottom)?ii.bottom:e),"y2"===c&&ri&&(f=b(ri.top)?ri.top:e,g=b(ri.bottom)?ri.bottom:e),ie(l)&&!Vc(l)&&(g=o),[o-g,p+f])}function bc(a){return Yh?qj?Ge(Yh):Yh:Zf.min(a,function(a){return Zf.min(a.values,function(a){return a.x})})}function cc(a){return Xh?qj?Ge(Xh):Xh:Zf.max(a,function(a){return Zf.max(a.values,function(a){return a.x})})}function dc(a){var c,d,e,f,g=Gc(a),h=g[1]-g[0];return rj?d=0:ie(a)?(c=Ec(),d=c>1?h/(c-1)/2:.5):d=.01*h,"object"==typeof Zh&&Le(Zh)?(e=b(Zh.left)?Zh.left:d,f=b(Zh.right)?Zh.right:d):e=f="number"==typeof Zh?Zh:d,{left:e,right:f}}function ec(a){var b=[bc(a),cc(a)],c=b[0],d=b[1],e=dc(a),f=0,g=0;return c-d!==0||rj||(c=qj?new Date(.5*c.getTime()):-.5,d=qj?new Date(1.5*d.getTime()):.5),(c||0===c)&&(f=qj?new Date(c.getTime()-e.left):c-e.left),(d||0===d)&&(g=qj?new Date(d.getTime()+e.right):d+e.right),[f,g]}function fc(a){return a[1]-a[0]}function gc(a){for(var b=0;bb?0:b-c}function mc(a){var b,c=kc(a),d="y"===a.axis?Rg:Sg;return b="y"===a.axis||"y2"===a.axis?Kh?vg:"start"in a?d(a.start):vg:Kh?"end"in a?Qg(qj?Ge(a.end):a.end):vg:vg,c>b?0:b-c}function nc(a){return $g&&a===$g||Le(_g)&&Me(_g,a)}function oc(a){return!nc(a)}function pc(a){return $g?$g:Le(_g)?_g[a]:null}function qc(a,b){var c,d=b&&Le(b)?Hc(b):[];return d.forEach(function(b){pc(b)===a&&(c=$f.data.xs[b])}),c}function rc(a,b){return a in $f.data.xs&&$f.data.xs[a]&&$f.data.xs[a][b]?$f.data.xs[a][b]:b}function sc(a){Object.keys(a).forEach(function(b){_g[b]=a[b]})}function tc(a){return 1===Zf.set(Object.keys(a).map(function(b){return a[b]})).size()}function uc(a){var b;return a&&(b=ch[a.id],a.name=b?b:a.id),a}function vc(a,b){a.forEach(function(a){a.values.forEach(function(c,d){c.x=xc(b[d],a.id,d)}),$f.data.xs[a.id]=b})}function wc(a,b){a.forEach(function(a){b[a.id]&&vc([a],b[a.id])})}function xc(a,c,d){var e;return e=qj?a?a instanceof Date?a:Ge(a):Ge(rc(c,d)):sj&&!rj?b(a)?+a:rc(c,d):d}function yc(a){var b,c,d=a[0],e={},f=[];for(b=1;b=0?$f.data.xs[c]=a.map(function(a){return a[f]}).filter(b).map(function(a,b){return xc(a,c,b)}):$g?(d=Object.keys($f.data.xs),$f.data.xs[c]=d.length>0?$f.data.xs[d[0]]:void 0):Le(_g)&&($f.data.xs[c]=qc(f,$f.data.targets)):$f.data.xs[c]=a.map(function(a,b){return b})}),d.forEach(function(a){if(!$f.data.xs[a])throw new Error('x is not defined for id = "'+a+'".')}),c=d.map(function(b,c){var d=bh(b);return{id:d,id_org:b,values:a.map(function(a,e){var f=pc(b),g=a[f],h=xc(g,b,e);return sj&&rj&&0===c&&g&&(0===e&&(Oh=[]),Oh.push(g)),("undefined"==typeof a[b]||$f.data.xs[b].length<=e)&&(h=void 0),{x:h,value:null===a[b]||isNaN(a[b])?null:+a[b],id:d}}).filter(function(a){return"undefined"!=typeof a.x})}}),c.forEach(function(a){var b;a.values=a.values.sort(function(a,b){var c=a.x||0===a.x?a.x:1/0,d=b.x||0===b.x?b.x:1/0;return c-d}),b=0,a.values.forEach(function(a){a.index=b++})}),gh&&ge(Hc(c).filter(function(a){return!(a in hh)}),gh),c.forEach(function(a){hc(a.id_org,a)}),c}function Bc(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 Cc(a){return a>0&&$f.data.targets[0].values[a-1]?$f.data.targets[0].values[a-1].x:void 0}function Dc(a){return a1?a.forEach(function(a){a.values.length>d&&(b=a,d=a.values.length)}):b=c?a[0]:null,b}function Gc(a){var b,c,d=Fc(a);return d?(b=d.values[0],c=d.values[d.values.length-1],[b.x,c.x]):[0,0]}function Hc(a){return a.map(function(a){return a.id})}function Ic(a){return a?"string"==typeof a?[a]:a:Hc($f.data.targets)}function Jc(a,b){var c,d=Hc(a);for(c=0;c2){for(f=c-2,d=a[0],e=a[a.length-1],g=(e-d)/(f+1),j=[d],h=0;f>h;h++)i=+d+g*(h+1),j.push(qj?new Date(i):i);j.push(e)}return qj||(j=j.sort(function(a,b){return a-b})),j}function Pc(a){Dj=Dj.concat(a)}function Qc(a){Dj=Dj.filter(function(b){return a.indexOf(b)<0})}function Rc(a){Ej=Ej.concat(a)}function Sc(a){Ej=Ej.filter(function(b){return a.indexOf(b)<0})}function Tc(a){var b={};return a.forEach(function(a){b[a.id]=[],a.values.forEach(function(c){b[a.id].push(c.value)})}),b}function Uc(a,b){var c,d,e,f=Object.keys(a);for(c=0;ca})}function Wc(a){return Uc(a,function(a){return a>0})}function Xc(a){return a=0&&d===a[c].x;c--)e.push(a[c]);for(c=b;c0?g=h:f=h,g-f===1||0===f&&0===g?(e=[],(a[f].x||0===a[f].x)&&(e=e.concat(Nd(a,f))),(a[g].x||0===a[g].x)&&(e=e.concat(Nd(a,g))),Qd(e,b)):Od(a,b,f,g)}function Pd(a,b){var c;return c=a.map(function(a){return Od(a.values,b)}),Qd(c,b)}function Qd(a,b){var c,d;return a.forEach(function(a){var e=Ne(a,b);(c>e||!c)&&(c=e,d=a)}),d}function Rd(a,b){return Zf.merge(a.map(function(a){return a.values})).filter(function(a){return a.x-b===0})}function Sd(a){var b=a.getBoundingClientRect(),c=[a.pathSegList.getItem(0),a.pathSegList.getItem(1)],d=c[0].x,e=Math.min(c[0].y,c[1].y);return{x:d,y:e,width:b.width,height:b.height}}function Td(){return jh&&"desc"===jh.toLowerCase()}function Ud(){return jh&&"asc"===jh.toLowerCase()}function Vd(a){var b=Ud(),c=Td();return b||c?a.sort(function(a,c){var d=function(a,b){return a+Math.abs(b.value)},e=a.values.reduce(d,0),f=c.values.reduce(d,0);return b?f-e:e-f}):"function"==typeof jh&&a.sort(jh),a}function Wd(a,c){var d,e,f,g,h,i,j,k=ne($f.data.targets),l=a.filter(function(a){return a&&b(a.value)});0!==l.length&&dj&&($j.html(gj(a,eb(),Dd(k),zj)).style("display","block"),d=$j.property("offsetWidth"),e=$j.property("offsetHeight"),k?(g=tg/2+c[0],i=vg/2+c[1]+20):(Kh?(f=s(),g=f+c[0]+100,h=g+d,j=t()-y(),i=Qg(l[0].x)+20):(f=s(),g=f+x()+Qg(l[0].x)+20,h=g+d,j=f+t()-y(),i=c[1]+15),h>j&&(g-=h-j),i+e>u()&&(i-=e+30)),$j.style("top",i+"px").style("left",g+"px"))}function Xd(){$j.style("display","none")}function Yd(a){var c=a.filter(function(a){return a&&b(a.value)});if(dj&&!je($f.data.targets)&&!ne($f.data.targets)){var d=Xj.selectAll("line."+g.xgridFocus);d.style("visibility","visible").data([c[0]]).attr(Kh?"y1":"x1",Jd).attr(Kh?"y2":"x2",Jd),Cf(d,"grid")}}function Zd(){Xj.select("line."+g.xgridFocus).style("visibility","hidden")}function $d(a,b){var c,d,e,f,h=[],i=Xj.select("."+g.axisX).selectAll(".tick").size();if("year"===a)for(c=ec(),d=c[0].getFullYear(),e=c[1].getFullYear(),f=d;e>=f;f++)h.push(new Date(f+"-01-01 00:00:00"));else h=b.ticks(10);return h.slice(0,i)}function _d(a){var b,d,e={},f=0;return Mc($f.data.targets.filter(a)).forEach(function(a){for(b=0;b0&&(i+=g(c.values[f].value)-h)}),i}}function de(a){return a.x||0===a.x?Qg(a.x):null}function ee(a,b){var c=_d(oe),d=sf(c);return eh.length>0?d(a,b)[0][1]:_(a.id)(a.value)}function fe(a,b){return"number"==typeof Gi?Gi:b?2*a.tickOffset()*Hi/b:0}function ge(a,b){Ic(a).forEach(function(a){ck[a]=b===hh[a],hh[a]=b}),a||(gh=b)}function he(a,b){var c=!1;return a.forEach(function(a){hh[a.id]===b&&(c=!0),a.id in hh||"line"!==b||(c=!0)}),c}function ie(a){return he(a,"bar")}function je(a){return he(a,"scatter")}function ke(a){return"pie"===gh||he(a,"pie")}function le(a){return he(a,"gauge")}function me(a){return"donut"===gh||he(a,"donut")}function ne(a){return ke(a)||me(a)||le(a)}function oe(a){var b="string"==typeof a?a:a.id;return!(b in hh)||["line","spline","area","area-spline","step","area-step"].indexOf(hh[b])>=0}function pe(a){var b="string"==typeof a?a:a.id;return["step","area-step"].indexOf(hh[b])>=0}function qe(a){var b="string"==typeof a?a:a.id;return["spline","area-spline"].indexOf(hh[b])>=0}function re(a){var b="string"==typeof a?a:a.id;return["area","area-spline","area-step"].indexOf(hh[b])>=0}function se(a){var b="string"==typeof a?a:a.id;return"bar"===hh[b]}function te(a){var b="string"==typeof a?a:a.id;return"scatter"===hh[b]}function ue(a){var b="string"==typeof a?a:a.id;return"pie"===hh[b]}function ve(a){var b="string"==typeof a?a:a.id;return"gauge"===hh[b]}function we(a){var b="string"==typeof a?a:a.id;return"donut"===hh[b]}function xe(a){return ue(a)||we(a)||ve(a)}function ye(a){return oe(a)?[a]:[]}function ze(a){return xe(a.data)?[a]:[]}function Ae(a){return se(a)?a.values:[]}function Be(a){return oe(a)||te(a)?a.values:[]}function Ce(a){return se(a)||oe(a)?a.values:[]}function De(a){return we(a)&&Zi||ue(a)&&Ki}function Ee(a,b,c){var d=[];return function(e){var f,g=e.id||e;return a[g]instanceof Function?f=a[g](e):a[g]?f=a[g]:(d.indexOf(g)<0&&d.push(g),f=b[d.indexOf(g)%b.length]),c instanceof Function?c(f,e):f}}function Fe(a,b){var c="value"===b.unit,d=b.values&&b.values.length?b.values:[],e=b.max||100;return function(b){var f,g,h=a[a.length-1];for(f=0;f0}function Me(a,b){var c=!1;return Object.keys(a).forEach(function(d){a[d]===b&&(c=!0)}),c}function Ne(a,b){var c="y"===db(a.id)?Rg:Sg,d=Kh?1:0,e=Kh?0:1;return Math.pow(Qg(a.x)-b[d],2)+Math.pow(c(a.value)-b[e],2)}function Oe(a,b){var c=0;a.each(function(){++c}).each("end",function(){--c||b.apply(this,arguments)})}function Pe(a,b,c){return d(a[b])?a[b]:c}function Qe(a){return 10*Math.ceil(a/10)}function Re(a,b){var c;return Zf.select("body").selectAll(".dummy").data([a]).enter().append("text").classed(b?b:"",!0).text(a).each(function(){c=this.getBoundingClientRect()}).remove(),c}function Se(a){return qe(a)?"cardinal":pe(a)?"step-after":"linear"}function Te(a,b,c){wh(b,a.node()),Xj.select("."+g.selectedCircles+sd(b.id)).selectAll("."+g.selectedCircle+"-"+c).data([b]).enter().append("circle").attr("class",function(){return Yc(g.selectedCircle,c)}).attr("cx",Kh?ee:de).attr("cy",Kh?de:ee).attr("stroke",function(){return zj(b)}).attr("r",1.4*cf(b)).transition().duration(100).attr("r",cf)}function Ue(a,b,c){xh(b,a.node()),Xj.select("."+g.selectedCircles+sd(b.id)).selectAll("."+g.selectedCircle+"-"+c).transition().duration(100).attr("r",0).remove()}function Ve(a,b,c,d){a?Te(b,c,d):Ue(b,c,d)}function We(a,b){wh(b,a.node()),a.transition().duration(100).style("fill",function(){return Zf.rgb(zj(b)).brighter(.75)})}function Xe(a,b){xh(b,a.node()),a.transition().duration(100).style("fill",function(){return zj(b) -})}function Ye(a,b,c,d){a?We(b,c,d):Xe(b,c,d)}function Ze(a,b,c,d){Ye(a,b,c.data,d)}function $e(a){return"circle"===a.nodeName?Ve:Zf.select(a).classed(g.bar)?Ye:Ze}function _e(a){return a.filter(function(a){return b(a.value)})}function af(a){return zi&&!pe(a)?"function"==typeof Ai?Ai(a):Ai:0}function bf(a){return Ci?Di?Di:1.75*af(a):af(a)}function cf(a){return Ei?Ei:4*af(a)}function df(a,c){return(c?Xj.selectAll("."+g.circles+sd(c)):Xj).selectAll("."+g.circle+(b(a)?"-"+a:""))}function ef(a,b){df(a,b).classed(g.EXPANDED,!0).attr("r",bf)}function ff(a){df(a).filter(function(){return Zf.select(this).classed(g.EXPANDED)}).classed(g.EXPANDED,!1).attr("r",af)}function gf(a){return Xj.selectAll("."+g.bar+(b(a)?"-"+a:""))}function hf(a){gf(a).classed(g.EXPANDED,!0)}function jf(a){gf(a).classed(g.EXPANDED,!1)}function kf(a,b){var c=Zf.svg.area(),d=qf(a,b),e=b?ab:_,f=function(a,b){return eh.length>0?d(a,b)[0][1]:e(a.id)(0)},g=function(a,b){return eh.length>0?d(a,b)[1][1]:e(a.id)(a.value)};return c=Kh?c.x0(f).x1(g).y(Jd):c.x(Jd).y0(f).y1(g),function(a){var b,d,e=_e(a.values);return re(a)?c.interpolate(Se(a))(e):(b=Qg(e[0].x),d=_(a.id)(e[0].value),Kh?"M "+d+" "+b:"M "+b+" "+d)}}function lf(a,b){var c=Zf.svg.line(),d=sf(a,b),e=b?ab:_,f=b?Md:Jd,g=function(a,b){return eh.length>0?d(a,b)[0][1]:e(a.id)(a.value)};return c=Kh?c.x(g).y(f):c.x(f).y(g),Fi||(c=c.defined(function(a){return null!=a.value})),function(a){var d=Fi?_e(a.values):a.values,f=b?f:Tg,g=e(a.id),h=0,i=0;return oe(a)?kh[a.id]?tf(d,f,g,kh[a.id]):c.interpolate(Se(a))(d):(d[0]&&(h=f(d[0].x),i=g(d[0].value)),Kh?"M "+i+" "+h:"M "+h+" "+i)}}function mf(a,b){var c=rf(a,b);return function(a,b){var d=c(a,b),e=Kh?1:0,f=Kh?0:1,g="M "+d[0][e]+","+d[0][f]+" L"+d[1][e]+","+d[1][f]+" L"+d[2][e]+","+d[2][f]+" L"+d[3][e]+","+d[3][f]+" z";return g}}function nf(a,b){var c=rf(a,!1),d=b?of:pf;return function(a,b){return d(c(a,b),a,this)}}function of(a,b){var c;return Kh?(c=se(b)?4:6,a[2][1]+c*(b.value<0?-1:1)):a[0][0]+(a[2][0]-a[0][0])/2}function pf(a,b,c){var d=c.getBoundingClientRect();return Kh?(a[0][0]+a[2][0]+.6*d.height)/2:a[2][1]+(b.value<0?d.height:se(b)?-3:-6)}function qf(a,b){var c=a.__max__+1,d=ae(0,c,a,!!b),e=be(!!b),f=ce(re,a,!!b),g=b?ab:_;return function(a,b){var c=g(a.id)(0),h=f(a,b)||c,i=d(a),j=e(a);return Kh&&(0j||a.value<0&&j>c)&&(j=c),[[i,h],[i,j-(c-h)]]}}function rf(a,b){var c=a.__max__+1,d=fe(Wg,c),e=ae(d,c,a,!!b),f=be(!!b),g=ce(se,a,!!b),h=b?ab:_;return function(a,b){var c=h(a.id)(0),i=g(a,b)||c,j=e(a),k=f(a);return Kh&&(0k||a.value<0&&k>c)&&(k=c),[[j,i],[j,k-(c-i)],[j+d,k-(c-i)],[j+d,i]]}}function sf(a,b){var c=a.__max__+1,d=ae(0,c,a,!!b),e=be(!!b),f=ce(oe,a,!!b),g=b?ab:_;return function(a,b){var c=g(a.id)(0),h=f(a,b)||c,i=d(a),j=e(a);return Kh&&(0j||a.value<0&&j>c)&&(j=c),[[i,j-(c-h)]]}}function tf(a,b,e,f){var g,h,i,j,k,l,m,n,o,p,q,r,s=-1,t="M",u=[];if(d(f))for(g=0;g=h;h+=p)t+=i(a[g-1],a[g],h,o);s=a[g].x}return t}function uf(b){var c=new MutationObserver(function(d){d.forEach(function(d){if("childList"===d.type&&d.previousSibling){c.disconnect();var e=a.setInterval(function(){b.node().parentNode&&(a.clearInterval(e),Df({withUpdateTranslate:!0,withTransform:!0,withUpdateXDomain:!0,withUpdateOrgXDomain:!0,withTransition:!1,withTransitionForTransform:!1,withLegend:!0}),b.transition().style("opacity",1))},10)}})});c.observe(b.node(),{attributes:!0,childList:!0,characterData:!0})}function vf(b){var c,d,e,f,h=!0;if(_j=Zf.select(ag),_j.empty()&&(_j=Zf.select(document.createElement("div")).style("opacity",0),uf(_j),h=!1),_j.html("").classed("c3",!0),$f.data.xs={},$f.data.targets=Ac(b),oh&&($f.data.targets=$f.data.targets.filter(oh)),nh&&Pc(nh===!0?Hc($f.data.targets):nh),le($f.data.targets)&&(Eh=!1),p(),W(),Qg.domain(Zf.extent(ec($f.data.targets))),Rg.domain(ac($f.data.targets,"y")),Sg.domain(ac($f.data.targets,"y2")),Tg.domain(Qg.domain()),Ug.domain(Rg.domain()),Vg.domain(Sg.domain()),ak=Qg.domain(),Tj.scale(Tg),hg&&Uj.scale(Qg),Vj=_j.append("svg").style("overflow","hidden").on("mouseenter",lg).on("mouseleave",mg),Wj=Vj.append("defs"),Wj.append("clipPath").attr("id",kj).append("rect"),Wj.append("clipPath").attr("id",lj).append("rect"),Wj.append("clipPath").attr("id",mj).append("rect"),Hf(),Xj=Vj.append("g").attr("transform",Kj.main),Yj=Vj.append("g").attr("transform",Kj.context),Zj=Vj.append("g").attr("transform",Kj.legend),Ah||Yj.style("visibility","hidden"),Eh||(Zj.style("visibility","hidden"),Ej=Hc($f.data.targets)),$j=_j.style("position","relative").append("div").style("position","absolute").style("pointer-events","none").style("z-index","10").style("display","none"),Uf(Hc($f.data.targets),{withTransform:!1,withTransitionForTransform:!1}),e=Xj.append("g").attr("clip-path",nj).attr("class",g.grid),ti&&e.append("g").attr("class",g.xgrids),Le(vi)&&e.append("g").attr("class",g.xgridLines),Bi&&e.append("g").attr("class",g.xgridFocus).append("line").attr("class",g.xgridFocus),wi&&e.append("g").attr("class",g.ygrids),Le(xi)&&e.append("g").attr("class",g.ygridLines),Xj.append("g").attr("clip-path",nj).attr("class",g.regions),Xj.append("g").attr("clip-path",nj).attr("class",g.chart),d=Xj.select("."+g.chart).append("g").attr("class",g.eventRects).style("fill-opacity",0).style("cursor",hg?Kh?"ns-resize":"ew-resize":null),Xj.select("."+g.chart).append("g").attr("class",g.chartBars),Xj.select("."+g.chart).append("g").attr("class",g.chartLines),c=Xj.select("."+g.chart).append("g").attr("class",g.chartArcs).attr("transform",Kj.arc),c.append("text").attr("class",g.chartArcsTitle).style("text-anchor","middle").text(Wb()),le($f.data.targets)&&(c.append("path").attr("class",g.chartArcsBackground).attr("d",function(){var a={data:[{value:Ri}],startAngle:-1*(Math.PI/2),endAngle:Math.PI/2};return Nb(a,!0,!0)}),c.append("text").attr("dy",".75em").attr("class",g.chartArcsGaugeUnit).style("text-anchor","middle").style("pointer-events","none").text(Oi?Vi:""),c.append("text").attr("dx",-1*(Bg+(zg-Bg)/2)+"px").attr("dy","1.2em").attr("class",g.chartArcsGaugeMin).style("text-anchor","middle").style("pointer-events","none").text(Oi?Qi:""),c.append("text").attr("dx",Bg+(zg-Bg)/2+"px").attr("dy","1.2em").attr("class",g.chartArcsGaugeMax).style("text-anchor","middle").style("pointer-events","none").text(Oi?Ri:"")),Xj.select("."+g.chart).append("g").attr("class",g.chartTexts),hg&&Xj.insert("rect",jg?null:"g."+g.grid).attr("class",g.zoomRect).attr("width",tg).attr("height",vg).style("opacity",0).style("cursor",Kh?"ns-resize":"ew-resize").call(Uj).on("dblclick.zoom",null),_h&&Tj.extent("function"!=typeof _h?_h:_h(ec())),Fj.x=Xj.append("g").attr("class",g.axisX).attr("clip-path",oj).attr("transform",Kj.x).style("visibility",Lh?"visible":"hidden"),Fj.x.append("text").attr("class",g.axisXLabel).attr("transform",Kh?"rotate(-90)":"").style("text-anchor",Fb),Fj.y=Xj.append("g").attr("class",g.axisY).attr("clip-path",pj).attr("transform",Kj.y).style("visibility",bi?"visible":"hidden"),Fj.y.append("text").attr("class",g.axisYLabel).attr("transform",Kh?"":"rotate(-90)").style("text-anchor",Gb),Fj.y2=Xj.append("g").attr("class",g.axisY2).attr("transform",Kj.y2).style("visibility",ki?"visible":"hidden"),Fj.y2.append("text").attr("class",g.axisY2Label).attr("transform",Kh?"":"rotate(-90)").style("text-anchor",Hb),Yj.append("g").attr("clip-path",nj).attr("class",g.chart),Yj.select("."+g.chart).append("g").attr("class",g.chartBars),Yj.select("."+g.chart).append("g").attr("class",g.chartLines),Yj.append("g").attr("clip-path",nj).attr("class",g.brush).call(Tj).selectAll("rect").attr(Kh?"width":"height",Kh?ug:wg),Fj.subx=Yj.append("g").attr("class",g.axisX).attr("transform",Kj.subx).attr("clip-path",Kh?"":oj),Kf($f.data.targets),h&&Df({withUpdateTranslate:!0,withTransform:!0,withUpdateXDomain:!0,withUpdateOrgXDomain:!0,withTransitionForAxis:!1}),hj){if(qj&&"string"==typeof ij){for(ij=Ge(ij),f=0;f<$f.data.targets[0].values.length&&$f.data.targets[0].values[f].x-ij!==0;f++);ij=f}$j.html(gj($f.data.targets.map(function(a){return uc(a.values[ij])}),eb(),Dd(ne($f.data.targets)),zj)),$j.style("top",jj.top).style("left",jj.left).style("display","block")}null==a.onresize&&(a.onresize=Gf()),a.onresize.add&&(a.onresize.add(ng),a.onresize.add(function(){$f.flush()}),a.onresize.add(og)),$f.element=_j.node()}function wf(a){a.append("rect").attr("class",md).style("cursor",ph&&qh?"pointer":null).on("mouseover",function(a,b){if(!uj&&!ne($f.data.targets)){var c=$f.data.targets.map(function(a){return uc(a.values[b])}),d=[];Object.keys(ch).forEach(function(a){for(var b=0;bf&&h>c&&d>i&&j>d;else{if(!n.classed(g.bar))return;m=Sd(this),c=m.x,d=m.y,e=m.width,k=m.height,l=Ye,q=!(c>h||f>c+e||d>j||i>d+k)}q^p&&(n.classed(g.INCLUDED,!p),n.classed(g.SELECTED,!o),l(!o,n,a,b))}))}function Af(a){ne($f.data.targets)||ph&&(tj=a,Xj.select("."+g.chart).append("rect").attr("class",g.dragarea).style("opacity",.1),uj=!0,yh())}function Bf(){ne($f.data.targets)||ph&&(Xj.select("."+g.dragarea).transition().duration(100).style("opacity",0).remove(),Xj.selectAll("."+g.shape).classed(g.INCLUDED,!1),uj=!1,zh())}function Cf(a,b){"grid"===b&&a.each(function(){var a=Zf.select(this),b=a.attr("x1"),c=a.attr("x2"),d=a.attr("y1"),e=a.attr("y2");a.attr({x1:Math.ceil(b),x2:Math.ceil(c),y1:Math.ceil(d),y2:Math.ceil(e)})})}function Df(a,c){var d,e,f,h,i,j,k,l,m,n,r,s,t,u,v,w,x,y,z,A,B,C,D,E,F,G,H,I,J,K,L,M,N,O,P,R,S,T,U,V,X,Y,Z,$,_,ab,bb,cb,db=_d(re),eb=_d(se),fb=_d(oe),gb=ne($f.data.targets),hb=Mc($f.data.targets);if(a=a||{},F=Pe(a,"withY",!0),G=Pe(a,"withSubchart",!0),H=Pe(a,"withTransition",!0),K=Pe(a,"withTransform",!1),L=Pe(a,"withUpdateXDomain",!1),M=Pe(a,"withUpdateOrgXDomain",!1),O=Pe(a,"withUpdateTranslate",!1),N=Pe(a,"withLegend",!1),I=Pe(a,"withTransitionForExit",H),J=Pe(a,"withTransitionForAxis",H),Z=H?pg:0,$=I?Z:0,_=J?Z:0,c=c||If(_),O&&(Kh?(Fj.x.call(Wg),Fj.subx.call(Zg)):(Fj.y.call(Xg),Fj.y2.call(Yg)),p(),W(),Hf(),o(!1)),N&&Eh&&Uf(Hc($f.data.targets),a,c),rj&&0===hb.length&&Qg.domain([0,Fj.x.selectAll(".tick").size()]),hb.length&&(M&&(Qg.domain(Zf.extent(ec(hb))),ak=Qg.domain(),hg&&Uj.scale(Qg).updateScaleExtent(),Tg.domain(Qg.domain()),Tj.scale(Tg)),L&&(Qg.domain(Tj.empty()?ak:Tj.extent()),hg&&Uj.scale(Qg).updateScaleExtent()),Vh||!Uh&&!Th||(ab=Oc(Nc(hb),Th),Wg.tickValues(ab),Zg.tickValues(ab))),Rg.domain(ac(hb,"y")),Sg.domain(ac(hb,"y2")),Fj.x.style("opacity",gb?0:1),Fj.y.style("opacity",gb?0:1),Fj.y2.style("opacity",gb?0:1),Fj.subx.style("opacity",gb?0:1),c.axisX.call(Wg),c.axisY.call(Xg),c.axisY2.call(Yg),c.axisSubX.call(Zg),Jb(H),L&&hb.length)if(Rh&&ab){for(bb=1;bb=0&&Zf.select(this).style("display",b%cb?"none":"block")})}else Vj.selectAll("."+g.axisX+" .tick text").style("display","block");!Kh&&Wh&&kb(Fj.x,c.axisX,Wh),P=kf(db,!1),S=mf(eb),U=lf(fb,!1),X=nf(eb,!0),Y=nf(eb,!1),Ug.domain(Rg.domain()),Vg.domain(Sg.domain()),$j.style("display","none"),q(),Xj.select("line."+g.xgridFocus).style("visibility","hidden"),ti&&(f=$d(ui,Qg),C=rj?Wg.tickOffset():0,e=Kh?{x1:0,x2:tg,y1:function(a){return Qg(a)-C},y2:function(a){return Qg(a)-C}}:{x1:function(a){return Qg(a)+C},x2:function(a){return Qg(a)+C},y1:qg.top,y2:vg},d=Xj.select("."+g.xgrids).selectAll("."+g.xgrid).data(f),d.enter().append("line").attr("class",g.xgrid),d.attr(e).style("opacity",function(){return+Zf.select(this).attr(Kh?"y1":"x1")===(Kh?vg:0)?0:1}),d.exit().remove()),Le(vi)&&(h=Xj.select("."+g.xgridLines).selectAll("."+g.xgridLine).data(vi),i=h.enter().append("g").attr("class",function(a){return g.xgridLine+(a.class?a.class:"")}),i.append("line").style("opacity",0),i.append("text").attr("text-anchor","end").attr("transform",Kh?"":"rotate(-90)").attr("dx",Kh?0:-qg.top).attr("dy",-5).style("opacity",0),h.select("line").transition().duration(Z).attr("x1",Kh?0:Kd).attr("x2",Kh?tg:Kd).attr("y1",Kh?Kd:qg.top).attr("y2",Kh?Kd:vg).style("opacity",1),h.select("text").transition().duration(Z).attr("x",Kh?tg:0).attr("y",Kd).text(function(a){return a.text}).style("opacity",1),h.exit().transition().duration(Z).style("opacity",0).remove()),F&&wi&&(j=Xj.select("."+g.ygrids).selectAll("."+g.ygrid).data(Rg.ticks(yi)),j.enter().append("line").attr("class",g.ygrid),j.attr("x1",Kh?Rg:0).attr("x2",Kh?Rg:tg).attr("y1",Kh?0:Rg).attr("y2",Kh?vg:Rg),j.exit().remove(),Cf(j,"grid")),F&&Le(xi)&&(k=Xj.select("."+g.ygridLines).selectAll("."+g.ygridLine).data(xi),l=k.enter().append("g").attr("class",function(a){return g.ygridLine+(a.class?a.class:"")}),l.append("line").style("opacity",0),l.append("text").attr("text-anchor","end").attr("transform",Kh?"rotate(-90)":"").attr("dx",Kh?0:-qg.top).attr("dy",-5).style("opacity",0),k.select("line").transition().duration(Z).attr("x1",Kh?Ld:0).attr("x2",Kh?Ld:tg).attr("y1",Kh?0:Ld).attr("y2",Kh?vg:Ld).style("opacity",1),k.select("text").transition().duration(Z).attr("x",Kh?0:tg).attr("y",Ld).text(function(a){return a.text}).style("opacity",1),k.exit().transition().duration(Z).style("opacity",0).remove()),u=Xj.select("."+g.regions).selectAll("."+g.region).data(cj),u.enter().append("g").attr("class",ld).append("rect").style("fill-opacity",0),u.selectAll("rect").transition().duration(Z).attr("x",jc).attr("y",kc).attr("width",lc).attr("height",mc).style("fill-opacity",function(a){return b(a.opacity)?a.opacity:.1}),u.exit().transition().duration(Z).style("opacity",0).remove(),s=Xj.selectAll("."+g.bars).selectAll("."+g.bar).data(Ae),s.enter().append("path").attr("class",fd).style("stroke",function(a){return zj(a.id)}).style("fill",function(a){return zj(a.id)}),s.style("opacity",xd).transition().duration(Z).attr("d",S).style("fill",zj).style("opacity",1),s.exit().transition().duration($).style("opacity",0).remove(),m=Xj.selectAll("."+g.lines).selectAll("."+g.line).data(ye),m.enter().append("path").attr("class",bd).style("stroke",zj),m.style("opacity",xd).transition().duration(Z).attr("d",U).style("stroke",zj).style("opacity",1),m.exit().transition().duration($).style("opacity",0).remove(),n=Xj.selectAll("."+g.areas).selectAll("."+g.area).data(ye),n.enter().append("path").attr("class",jd).style("fill",zj).style("opacity",function(){return bk=+Zf.select(this).style("opacity"),0}),n.style("opacity",0).transition().duration(Z).attr("d",P).style("fill",zj).style("opacity",bk),n.exit().transition().duration($).style("opacity",0).remove(),zi&&(r=Xj.selectAll("."+g.circles).selectAll("."+g.circle).data(Be),r.enter().append("circle").attr("class",dd).attr("r",af).style("fill",zj),r.style("opacity",xd).transition().duration(Z).style("opacity",zd).style("fill",zj).attr("cx",Kh?ee:de).attr("cy",Kh?de:ee),r.exit().remove()),Bd()&&(v=Xj.selectAll("."+g.texts).selectAll("."+g.text).data(Ce),v.enter().append("text").attr("class",Zc).attr("text-anchor",function(a){return Kh?a.value<0?"end":"start":"middle"}).style("stroke","none").style("fill",zj).style("fill-opacity",0),v.text(function(a){return Id(a.id)(a.value,a.id)}).style("fill-opacity",yd).transition().duration(Z).attr("x",X).attr("y",Y).style("fill",zj).style("fill-opacity",Ad),v.exit().transition().duration($).style("fill-opacity",0).remove()),t=Xj.selectAll("."+g.arcs).selectAll("."+g.arc).data(ze),t.enter().append("path").attr("class",hd).style("fill",function(a){return zj(a.data)}).style("cursor",function(a){return rh(a)?"pointer":null}).style("opacity",0).each(function(a){ve(a.data)&&(a.startAngle=a.endAngle=-1*(Math.PI/2)),this._current=a}).on("mouseover",function(a,b){var c,d,e;xj||(c=Kb(a),d=Qb(c),e=Yb(),Sb(c.data.id),Qf(c.data.id,!0),e(d,b))}).on("mousemove",function(a){var b=Kb(a),c=Qb(b),d=[c];Wd(d,Zf.mouse(this))}).on("mouseout",function(a,b){var c,d,e;xj||(c=Kb(a),d=Qb(c),e=Zb(),Tb(c.data.id),Rf(),Xd(),e(d,b))}).on("click",function(a,b){var c=Kb(a),d=Qb(c),e=Xb();yf(this,a,b),e(d,b)}),t.attr("transform",function(a){return!ve(a.data)&&K?"scale(0)":""}).style("opacity",function(a){return a===this._current?0:1}).each(function(){xj=!0}).transition().duration(Z).attrTween("d",function(a){var b,c=Kb(a);return c?(isNaN(this._current.endAngle)&&(this._current.endAngle=this._current.startAngle),b=Zf.interpolate(this._current,c),this._current=b(0),function(a){return Nb(b(a),!0)}):function(){return"M 0 0"}}).attr("transform",K?"scale(1)":"").style("fill",function(a){return Aj?Aj(a.data.values[0].value):zj(a.data.id)}).style("opacity",1).call(Oe,function(){xj=!1}),t.exit().transition().duration($).style("opacity",0).remove(),Xj.selectAll("."+g.chartArc).select("text").style("opacity",0).attr("class",function(a){return ve(a.data)?g.gaugeValue:""}).text(Rb).attr("transform",Ob).transition().duration(Z).style("opacity",function(a){return Kc(a.data.id)&&xe(a.data)?1:0}),Xj.select("."+g.chartArcsTitle).style("opacity",me($f.data.targets)||le($f.data.targets)?1:0),Ah&&(Zf.event&&"zoom"===Zf.event.type&&Tj.extent(Qg.orgDomain()).update(),G&&(!Kh&&Wh&&kb(Fj.subx,c.axisSubX,Wh),Tj.empty()||Tj.extent(Qg.orgDomain()).update(),R=kf(db,!0),T=mf(eb,!0),V=lf(fb,!0),y=Yj.selectAll("."+g.bars).selectAll("."+g.bar).data(Ae),y.enter().append("path").attr("class",fd).style("stroke","none").style("fill",zj),y.style("opacity",xd).transition().duration(Z).attr("d",T).style("opacity",1),y.exit().transition().duration(Z).style("opacity",0).remove(),w=Yj.selectAll("."+g.lines).selectAll("."+g.line).data(ye),w.enter().append("path").attr("class",bd).style("stroke",zj),w.style("opacity",xd).transition().duration(Z).attr("d",V).style("opacity",1),w.exit().transition().duration(Z).style("opacity",0).remove(),x=Yj.selectAll("."+g.areas).selectAll("."+g.area).data(ye),x.enter().append("path").attr("class",jd).style("fill",zj).style("opacity",function(){return bk=+Zf.select(this).style("opacity"),0}),x.style("opacity",0).transition().duration(Z).attr("d",R).style("fill",zj).style("opacity",bk),x.exit().transition().duration($).style("opacity",0).remove())),Xj.selectAll("."+g.selectedCircles).filter(function(a){return se(a)}).selectAll("circle").remove(),Xj.selectAll("."+g.selectedCircle).transition().duration(Z).attr("cx",Kh?ee:de).attr("cy",Kh?de:ee),kg&&(z=Xj.select("."+g.eventRects),Le(_g)&&!tc(_g)?(z.classed(g.eventRectsMultiple)||z.classed(g.eventRectsMultiple,!0).classed(g.eventRectsSingle,!1).selectAll("."+g.eventRect).remove(),A=Xj.select("."+g.eventRects).selectAll("."+g.eventRect).data([0]),xf(A.enter()),A.attr("x",0).attr("y",0).attr("width",tg).attr("height",vg)):(z.classed(g.eventRectsSingle)||z.classed(g.eventRectsMultiple,!1).classed(g.eventRectsSingle,!0).selectAll("."+g.eventRect).remove(),!sj&&!qj||rj?(E=Q(),D=function(a){return Qg(a.x)-E/2}):(E=function(a,b){var c=Cc(b),d=Dc(b),e=$f.data.xs[a.id][b],f=Qg(d?d:e),g=Qg(c?c:e);return(f-g)/2},D=function(a,b){var c=Cc(b),d=$f.data.xs[a.id][b];return(Qg(d)+Qg(c?c:d))/2}),B=Fc($f.data.targets),Xj.select("."+g.eventRects).datum(B?B.values:[]),A=Xj.select("."+g.eventRects).selectAll("."+g.eventRect).data(function(a){return a}),wf(A.enter()),A.attr("class",md).attr("x",Kh?0:D).attr("y",Kh?D:0).attr("width",Kh?tg:E).attr("height",Kh?E:vg),A.exit().remove())),Hc($f.data.targets).forEach(function(a){ck[a]=!0})}function Ef(){Df({withTransition:!1,withY:!1,withSubchart:!1,withUpdateXDomain:!0})}function Ff(){if(0!==Mc($f.data.targets).length){if("mousemove"===Zf.event.sourceEvent.type&&Uj.altDomain)return Qg.domain(Uj.altDomain),void Uj.scale(Qg).updateScaleExtent();rj&&Qg.orgDomain()[0]===ak[0]&&Qg.domain([ak[0]-1e-10,Qg.orgDomain()[1]]),Df({withTransition:!1,withY:!1,withSubchart:!1}),"mousemove"===Zf.event.sourceEvent.type&&(vj=!0)}}function Gf(){function a(){b.forEach(function(a){a()})}var b=[];return a.add=function(a){b.push(a)},a}function Hf(){Vj.attr("width",xg).attr("height",yg),Vj.select("#"+kj).select("rect").attr("width",tg).attr("height",vg),Vj.select("#"+lj).select("rect").attr("x",G).attr("y",H).attr("width",M).attr("height",N),Vj.select("#"+mj).select("rect").attr("x",I).attr("y",J).attr("width",O).attr("height",P),Vj.select("."+g.zoomRect).attr("width",tg).attr("height",vg),_j.style("max-height",yg+"px")}function If(a){return{axisX:a?Fj.x.transition().duration(a):Fj.x,axisY:a?Fj.y.transition().duration(a):Fj.y,axisY2:a?Fj.y2.transition().duration(a):Fj.y2,axisSubX:a?Fj.subx.transition().duration(a):Fj.subx}}function Jf(a){var b;a=a||{},a.withTransition=Pe(a,"withTransition",!0),a.withTransform=Pe(a,"withTransform",!1),a.withLegend=Pe(a,"withLegend",!1),a.withUpdateXDomain=!0,a.withUpdateOrgXDomain=!0,a.withTransitionForExit=!1,a.withLegend&&Eh||(b=If(a.withTransitionForAxis?pg:0),p(),W(),Hf(),o(a.withTransition,b)),Df(a,b)}function Kf(a){var b,c,d,e,f,h,i,j,k,l,m,n;i=Xj.select("."+g.chartTexts).selectAll("."+g.chartText).data(a).attr("class",od),j=i.enter().append("g").attr("class",od).style("opacity",0).style("pointer-events","none"),j.append("g").attr("class",$c),e=Xj.select("."+g.chartBars).selectAll("."+g.chartBar).data(a).attr("class",qd),d=e.enter().append("g").attr("class",qd).style("opacity",0).style("pointer-events","none"),d.append("g").attr("class",gd).style("cursor",function(a){return rh(a)?"pointer":null}),c=Xj.select("."+g.chartLines).selectAll("."+g.chartLine).data(a).attr("class",pd),b=c.enter().append("g").attr("class",pd).style("opacity",0).style("pointer-events","none"),b.append("g").attr("class",cd),b.append("g").attr("class",kd),b.append("g").attr("class",function(a){return Yc(g.selectedCircles,a.id)}),b.append("g").attr("class",ed).style("cursor",function(a){return rh(a)?"pointer":null}),a.forEach(function(a){Xj.selectAll("."+g.selectedCircles+sd(a.id)).selectAll("."+g.selectedCircle).each(function(b){b.value=a.values[b.index].value})}),h=Xj.select("."+g.chartArcs).selectAll("."+g.chartArc).data(Hg(a)).attr("class",rd),f=h.enter().append("g").attr("class",rd),f.append("g").attr("class",id),f.append("text").attr("dy",le($f.data.targets)?"-0.35em":".35em").style("opacity",0).style("text-anchor","middle").style("pointer-events","none"),Ah&&(n=Yj.select("."+g.chartBars).selectAll("."+g.chartBar).data(a).attr("class",qd),m=n.enter().append("g").style("opacity",0).attr("class",qd),m.append("g").attr("class",gd),l=Yj.select("."+g.chartLines).selectAll("."+g.chartLine).data(a).attr("class",pd),k=l.enter().append("g").style("opacity",0).attr("class",pd),k.append("g").attr("class",cd),k.append("g").attr("class",kd)),Vj.selectAll("."+g.target).filter(function(a){return Kc(a.id)}).transition().duration(pg).style("opacity",1)}function Lf(a,b){b.filter&&(a=a.filter(b.filter)),(b.type||b.types)&&a.forEach(function(a){b.types?ge(a.id,b.types[a.id]):ge(a.id,b.type)}),$f.data.targets.forEach(function(b){for(var c=0;cf&&(f=(m-l)/2,z=0,F++)),E[a]=F,D[F]=f,A[a]=z,z+=l}var f,h,i=Re(b.textContent,g.legendItem),j=10*Math.ceil((i.width+v)/10),k=10*Math.ceil((i.height+u)/10),l=Lj?k:j,m=Lj?V():U();return d&&(z=0,F=0,w=0,x=0),Eh&&!Lc(c)?void(B[c]=C[c]=E[c]=A[c]=0):(B[c]=j,C[c]=k,(!w||j>=w)&&(w=j),(!x||k>=x)&&(x=k),h=Lj?x:w,void(Jh?(Object.keys(B).forEach(function(a){B[a]=w}),Object.keys(C).forEach(function(a){C[a]=x}),f=(m-h*a.length)/2,y>f?(z=0,F=0,a.forEach(function(a){e(a)})):e(c,!0)):e(c)))}var f,h,i,j,k,l,m,n,q,r,s,t,u=4,v=26,w=0,x=0,y=10,z=0,A={},B={},C={},D=[0],E={},F=0,G=Zj.selectAll("."+g.legendItemFocused).size();b=b||{},n=Pe(b,"withTransition",!0),q=Pe(b,"withTransitionForTransform",!0),Lj?(f=function(a){return w*E[a]},j=function(a){return D[E[a]]+A[a]}):(f=function(a){return D[E[a]]+A[a]},j=function(a){return x*E[a]}),h=function(a,b){return f(a,b)+14},k=function(a,b){return j(a,b)+9},i=function(a,b){return f(a,b)-4},l=function(a,b){return j(a,b)-7},m=Zj.selectAll("."+g.legendItem).data(a).enter().append("g").attr("class",function(a){return Yc(g.legendItem,a)}).style("visibility",function(a){return Lc(a)?"visible":"hidden"}).style("cursor","pointer").on("click",function(a){"function"==typeof Gh?Gh(a):$f.toggle(a)}).on("mouseover",function(a){Zf.select(this).classed(g.legendItemFocused,!0),xj||$f.focus(a),"function"==typeof Hh&&Hh(a)}).on("mouseout",function(a){Zf.select(this).classed(g.legendItemFocused,!1),xj||$f.revert(),"function"==typeof Ih&&Ih(a)}),m.append("text").text(function(a){return d(ch[a])?ch[a]:a}).each(function(a,b){e(this,a,0===b)}).style("pointer-events","none").attr("x",Lj?h:-200).attr("y",Lj?-200:k),m.append("rect").attr("class",g.legendItemEvent).style("fill-opacity",0).attr("x",Lj?i:-200).attr("y",Lj?-200:l),m.append("rect").attr("class",g.legendItemTile).style("pointer-events","none").style("fill",zj).attr("x",Lj?h:-200).attr("y",Lj?-200:j).attr("width",10).attr("height",10),r=Zj.selectAll("text").data(a).text(function(a){return d(ch[a])?ch[a]:a}).each(function(a,b){e(this,a,0===b)}),(n?r.transition():r).attr("x",h).attr("y",k),s=Zj.selectAll("rect."+g.legendItemEvent).data(a),(n?s.transition():s).attr("width",function(a){return B[a]}).attr("height",function(a){return C[a]}).attr("x",i).attr("y",l),t=Zj.selectAll("rect."+g.legendItemTile).data(a),(n?t.transition():t).style("fill",zj).attr("x",f).attr("y",j),Zj.selectAll("."+g.legendItem).classed(g.legendItemHidden,function(a){return!Kc(a)}).transition().style("opacity",function(a){var b=Zf.select(this);return Kc(a)?!G||b.classed(g.legendItemFocused)?Of(b):Pf(b):Pj}),S(w),T(x),R(F),p(),W(),Hf(),o(q,c)}function Vf(a){return Jc($f.data.targets,a.id)}function Wf(a){return"data"in a&&Jc($f.data.targets,a.data.id)}function Xf(a){var b=a&&a.value?a.value:null,c=a&&a["class"]?a["class"]:null;return b?function(a){return a.value!==b}:c?function(a){return a["class"]!==c}:function(){return!0}}function Yf(a,b,c){var d=!ne($f.data.targets);xj=!1,ge(a,b),Jf(c||{withTransitionForAxis:d})}var Zf=a.d3?a.d3:"undefined"!=typeof require?require("d3"):void 0,$f={data:{},axis:{},legend:{}},_f={},ag=i(["bindto"],"#chart"),bg=i(["size","width"]),cg=i(["size","height"]),dg=i(["padding","left"]),eg=i(["padding","right"]),fg=i(["padding","top"]),gg=i(["padding","bottom"]),hg=i(["zoom","enabled"],!1),ig=i(["zoom","extent"]),jg=i(["zoom","privileged"],!1),kg=i(["interaction","enabled"],!0),lg=i(["onenter"],function(){}),mg=i(["onleave"],function(){}),ng=i(["onresize"],function(){}),og=i(["onresized"],function(){}),pg=i(["transition","duration"],350);h("data","data is required in config");var qg,rg,sg,tg,ug,vg,wg,xg,yg,zg,Ag,Bg,Cg,Dg,Eg,Fg,Gg,Hg,Ig,Jg,Kg,Lg,Mg,Ng,Og,Pg,Qg,Rg,Sg,Tg,Ug,Vg,Wg,Xg,Yg,Zg,$g=i(["data","x"]),_g=i(["data","xs"],{}),ah=i(["data","x_format"]),bh=i(["data","id_converter"],function(a){return a +})}function Ye(a,b,c,d){a?We(b,c,d):Xe(b,c,d)}function Ze(a,b,c,d){Ye(a,b,c.data,d)}function $e(a){return"circle"===a.nodeName?Ve:Zf.select(a).classed(g.bar)?Ye:Ze}function _e(a){return a.filter(function(a){return b(a.value)})}function af(a){return zi&&!pe(a)?"function"==typeof Ai?Ai(a):Ai:0}function bf(a){return Ci?Di?Di:1.75*af(a):af(a)}function cf(a){return Ei?Ei:4*af(a)}function df(a,c){return(c?Xj.selectAll("."+g.circles+sd(c)):Xj).selectAll("."+g.circle+(b(a)?"-"+a:""))}function ef(a,b){df(a,b).classed(g.EXPANDED,!0).attr("r",bf)}function ff(a){df(a).filter(function(){return Zf.select(this).classed(g.EXPANDED)}).classed(g.EXPANDED,!1).attr("r",af)}function gf(a){return Xj.selectAll("."+g.bar+(b(a)?"-"+a:""))}function hf(a){gf(a).classed(g.EXPANDED,!0)}function jf(a){gf(a).classed(g.EXPANDED,!1)}function kf(a,b){var c=Zf.svg.area(),d=qf(a,b),e=b?ab:_,f=function(a,b){return eh.length>0?d(a,b)[0][1]:e(a.id)(0)},g=function(a,b){return eh.length>0?d(a,b)[1][1]:e(a.id)(a.value)};return c=Kh?c.x0(f).x1(g).y(Jd):c.x(Jd).y0(f).y1(g),function(a){var b,d,e=_e(a.values);return re(a)?c.interpolate(Se(a))(e):(b=Qg(e[0].x),d=_(a.id)(e[0].value),Kh?"M "+d+" "+b:"M "+b+" "+d)}}function lf(a,b){var c=Zf.svg.line(),d=sf(a,b),e=b?ab:_,f=b?Md:Jd,g=function(a,b){return eh.length>0?d(a,b)[0][1]:e(a.id)(a.value)};return c=Kh?c.x(g).y(f):c.x(f).y(g),Fi||(c=c.defined(function(a){return null!=a.value})),function(a){var d=Fi?_e(a.values):a.values,f=b?f:Tg,g=e(a.id),h=0,i=0;return oe(a)?kh[a.id]?tf(d,f,g,kh[a.id]):c.interpolate(Se(a))(d):(d[0]&&(h=f(d[0].x),i=g(d[0].value)),Kh?"M "+i+" "+h:"M "+h+" "+i)}}function mf(a,b){var c=rf(a,b);return function(a,b){var d=c(a,b),e=Kh?1:0,f=Kh?0:1,g="M "+d[0][e]+","+d[0][f]+" L"+d[1][e]+","+d[1][f]+" L"+d[2][e]+","+d[2][f]+" L"+d[3][e]+","+d[3][f]+" z";return g}}function nf(a,b){var c=rf(a,!1),d=b?of:pf;return function(a,b){return d(c(a,b),a,this)}}function of(a,b){var c;return Kh?(c=se(b)?4:6,a[2][1]+c*(b.value<0?-1:1)):a[0][0]+(a[2][0]-a[0][0])/2}function pf(a,b,c){var d=c.getBoundingClientRect();return Kh?(a[0][0]+a[2][0]+.6*d.height)/2:a[2][1]+(b.value<0?d.height:se(b)?-3:-6)}function qf(a,b){var c=a.__max__+1,d=ae(0,c,a,!!b),e=be(!!b),f=ce(re,a,!!b),g=b?ab:_;return function(a,b){var c=g(a.id)(0),h=f(a,b)||c,i=d(a),j=e(a);return Kh&&(0j||a.value<0&&j>c)&&(j=c),[[i,h],[i,j-(c-h)]]}}function rf(a,b){var c=a.__max__+1,d=fe(Wg,c),e=ae(d,c,a,!!b),f=be(!!b),g=ce(se,a,!!b),h=b?ab:_;return function(a,b){var c=h(a.id)(0),i=g(a,b)||c,j=e(a),k=f(a);return Kh&&(0k||a.value<0&&k>c)&&(k=c),[[j,i],[j,k-(c-i)],[j+d,k-(c-i)],[j+d,i]]}}function sf(a,b){var c=a.__max__+1,d=ae(0,c,a,!!b),e=be(!!b),f=ce(oe,a,!!b),g=b?ab:_;return function(a,b){var c=g(a.id)(0),h=f(a,b)||c,i=d(a),j=e(a);return Kh&&(0j||a.value<0&&j>c)&&(j=c),[[i,j-(c-h)]]}}function tf(a,b,e,f){var g,h,i,j,k,l,m,n,o,p,q,r,s=-1,t="M",u=[];if(d(f))for(g=0;g=h;h+=p)t+=i(a[g-1],a[g],h,o);s=a[g].x}return t}function uf(b){var c=new MutationObserver(function(d){d.forEach(function(d){if("childList"===d.type&&d.previousSibling){c.disconnect();var e=a.setInterval(function(){b.node().parentNode&&(a.clearInterval(e),Df({withUpdateTranslate:!0,withTransform:!0,withUpdateXDomain:!0,withUpdateOrgXDomain:!0,withTransition:!1,withTransitionForTransform:!1,withLegend:!0}),b.transition().style("opacity",1))},10)}})});c.observe(b.node(),{attributes:!0,childList:!0,characterData:!0})}function vf(b){var c,d,e,f,h=!0;if(_j=Zf.select(ag),_j.empty()&&(_j=Zf.select(document.createElement("div")).style("opacity",0),uf(_j),h=!1),_j.html("").classed("c3",!0),$f.data.xs={},$f.data.targets=Ac(b),oh&&($f.data.targets=$f.data.targets.filter(oh)),nh&&Pc(nh===!0?Hc($f.data.targets):nh),le($f.data.targets)&&(Eh=!1),p(),W(),Qg.domain(Zf.extent(ec($f.data.targets))),Rg.domain(ac($f.data.targets,"y")),Sg.domain(ac($f.data.targets,"y2")),Tg.domain(Qg.domain()),Ug.domain(Rg.domain()),Vg.domain(Sg.domain()),ak=Qg.domain(),Tj.scale(Tg),hg&&Uj.scale(Qg),Vj=_j.append("svg").style("overflow","hidden").on("mouseenter",lg).on("mouseleave",mg),Wj=Vj.append("defs"),Wj.append("clipPath").attr("id",kj).append("rect"),Wj.append("clipPath").attr("id",lj).append("rect"),Wj.append("clipPath").attr("id",mj).append("rect"),Hf(),Xj=Vj.append("g").attr("transform",Kj.main),Yj=Vj.append("g").attr("transform",Kj.context),Zj=Vj.append("g").attr("transform",Kj.legend),Ah||Yj.style("visibility","hidden"),Eh||(Zj.style("visibility","hidden"),Ej=Hc($f.data.targets)),$j=_j.style("position","relative").append("div").style("position","absolute").style("pointer-events","none").style("z-index","10").style("display","none"),Uf(Hc($f.data.targets),{withTransform:!1,withTransitionForTransform:!1}),e=Xj.append("g").attr("clip-path",nj).attr("class",g.grid),ti&&e.append("g").attr("class",g.xgrids),Le(vi)&&e.append("g").attr("class",g.xgridLines),Bi&&e.append("g").attr("class",g.xgridFocus).append("line").attr("class",g.xgridFocus),wi&&e.append("g").attr("class",g.ygrids),Le(xi)&&e.append("g").attr("class",g.ygridLines),Xj.append("g").attr("clip-path",nj).attr("class",g.regions),Xj.append("g").attr("clip-path",nj).attr("class",g.chart),d=Xj.select("."+g.chart).append("g").attr("class",g.eventRects).style("fill-opacity",0).style("cursor",hg?Kh?"ns-resize":"ew-resize":null),Xj.select("."+g.chart).append("g").attr("class",g.chartBars),Xj.select("."+g.chart).append("g").attr("class",g.chartLines),c=Xj.select("."+g.chart).append("g").attr("class",g.chartArcs).attr("transform",Kj.arc),c.append("text").attr("class",g.chartArcsTitle).style("text-anchor","middle").text(Wb()),le($f.data.targets)&&(c.append("path").attr("class",g.chartArcsBackground).attr("d",function(){var a={data:[{value:Ri}],startAngle:-1*(Math.PI/2),endAngle:Math.PI/2};return Nb(a,!0,!0)}),c.append("text").attr("dy",".75em").attr("class",g.chartArcsGaugeUnit).style("text-anchor","middle").style("pointer-events","none").text(Oi?Vi:""),c.append("text").attr("dx",-1*(Bg+(zg-Bg)/2)+"px").attr("dy","1.2em").attr("class",g.chartArcsGaugeMin).style("text-anchor","middle").style("pointer-events","none").text(Oi?Qi:""),c.append("text").attr("dx",Bg+(zg-Bg)/2+"px").attr("dy","1.2em").attr("class",g.chartArcsGaugeMax).style("text-anchor","middle").style("pointer-events","none").text(Oi?Ri:"")),Xj.select("."+g.chart).append("g").attr("class",g.chartTexts),hg&&Xj.insert("rect",jg?null:"g."+g.grid).attr("class",g.zoomRect).attr("width",tg).attr("height",vg).style("opacity",0).style("cursor",Kh?"ns-resize":"ew-resize").call(Uj).on("dblclick.zoom",null),_h&&Tj.extent("function"!=typeof _h?_h:_h(ec())),Fj.x=Xj.append("g").attr("class",g.axisX).attr("clip-path",oj).attr("transform",Kj.x).style("visibility",Lh?"visible":"hidden"),Fj.x.append("text").attr("class",g.axisXLabel).attr("transform",Kh?"rotate(-90)":"").style("text-anchor",Fb),Fj.y=Xj.append("g").attr("class",g.axisY).attr("clip-path",pj).attr("transform",Kj.y).style("visibility",bi?"visible":"hidden"),Fj.y.append("text").attr("class",g.axisYLabel).attr("transform",Kh?"":"rotate(-90)").style("text-anchor",Gb),Fj.y2=Xj.append("g").attr("class",g.axisY2).attr("transform",Kj.y2).style("visibility",ki?"visible":"hidden"),Fj.y2.append("text").attr("class",g.axisY2Label).attr("transform",Kh?"":"rotate(-90)").style("text-anchor",Hb),Yj.append("g").attr("clip-path",nj).attr("class",g.chart),Yj.select("."+g.chart).append("g").attr("class",g.chartBars),Yj.select("."+g.chart).append("g").attr("class",g.chartLines),Yj.append("g").attr("clip-path",nj).attr("class",g.brush).call(Tj).selectAll("rect").attr(Kh?"width":"height",Kh?ug:wg),Fj.subx=Yj.append("g").attr("class",g.axisX).attr("transform",Kj.subx).attr("clip-path",Kh?"":oj),Kf($f.data.targets),h&&Df({withUpdateTranslate:!0,withTransform:!0,withUpdateXDomain:!0,withUpdateOrgXDomain:!0,withTransitionForAxis:!1}),hj){if(qj&&"string"==typeof ij){for(ij=Ge(ij),f=0;f<$f.data.targets[0].values.length&&$f.data.targets[0].values[f].x-ij!==0;f++);ij=f}$j.html(gj($f.data.targets.map(function(a){return uc(a.values[ij])}),eb(),Dd(ne($f.data.targets)),zj)),$j.style("top",jj.top).style("left",jj.left).style("display","block")}null==a.onresize&&(a.onresize=Gf()),a.onresize.add&&(a.onresize.add(ng),a.onresize.add(function(){$f.flush()}),a.onresize.add(og)),$f.element=_j.node()}function wf(a){a.append("rect").attr("class",md).style("cursor",ph&&qh?"pointer":null).on("mouseover",function(a,b){if(!uj&&!ne($f.data.targets)){var c=$f.data.targets.map(function(a){return uc(a.values[b])}),d=[];Object.keys(ch).forEach(function(a){for(var b=0;bf&&h>c&&d>i&&j>d;else{if(!n.classed(g.bar))return;m=Sd(this),c=m.x,d=m.y,e=m.width,k=m.height,l=Ye,q=!(c>h||f>c+e||d>j||i>d+k)}q^p&&(n.classed(g.INCLUDED,!p),n.classed(g.SELECTED,!o),l(!o,n,a,b))}))}function Af(a){ne($f.data.targets)||ph&&(tj=a,Xj.select("."+g.chart).append("rect").attr("class",g.dragarea).style("opacity",.1),uj=!0,yh())}function Bf(){ne($f.data.targets)||ph&&(Xj.select("."+g.dragarea).transition().duration(100).style("opacity",0).remove(),Xj.selectAll("."+g.shape).classed(g.INCLUDED,!1),uj=!1,zh())}function Cf(a,b){"grid"===b&&a.each(function(){var a=Zf.select(this),b=a.attr("x1"),c=a.attr("x2"),d=a.attr("y1"),e=a.attr("y2");a.attr({x1:Math.ceil(b),x2:Math.ceil(c),y1:Math.ceil(d),y2:Math.ceil(e)})})}function Df(a,c){var d,e,f,h,i,j,k,l,m,n,r,s,t,u,v,w,x,y,z,A,B,C,D,E,F,G,H,I,J,K,L,M,N,O,P,R,S,T,U,V,X,Y,Z,$,_,ab,bb,cb,db=_d(re),eb=_d(se),fb=_d(oe),gb=ne($f.data.targets),hb=Mc($f.data.targets);if(a=a||{},F=Pe(a,"withY",!0),G=Pe(a,"withSubchart",!0),H=Pe(a,"withTransition",!0),K=Pe(a,"withTransform",!1),L=Pe(a,"withUpdateXDomain",!1),M=Pe(a,"withUpdateOrgXDomain",!1),O=Pe(a,"withUpdateTranslate",!1),N=Pe(a,"withLegend",!1),I=Pe(a,"withTransitionForExit",H),J=Pe(a,"withTransitionForAxis",H),Z=H?pg:0,$=I?Z:0,_=J?Z:0,c=c||If(_),O&&(Kh?(Fj.x.call(Wg),Fj.subx.call(Zg)):(Fj.y.call(Xg),Fj.y2.call(Yg)),p(),W(),Hf(),o(!1)),N&&Eh&&Uf(Hc($f.data.targets),a,c),rj&&0===hb.length&&Qg.domain([0,Fj.x.selectAll(".tick").size()]),hb.length&&(M&&(Qg.domain(Zf.extent(ec(hb))),ak=Qg.domain(),hg&&Uj.scale(Qg).updateScaleExtent(),Tg.domain(Qg.domain()),Tj.scale(Tg)),L&&(Qg.domain(Tj.empty()?ak:Tj.extent()),hg&&Uj.scale(Qg).updateScaleExtent()),Vh||!Uh&&!Th||(ab=Oc(Nc(hb),Th),Wg.tickValues(ab),Zg.tickValues(ab))),Rg.domain(ac(hb,"y")),Sg.domain(ac(hb,"y2")),Fj.x.style("opacity",gb?0:1),Fj.y.style("opacity",gb?0:1),Fj.y2.style("opacity",gb?0:1),Fj.subx.style("opacity",gb?0:1),c.axisX.call(Wg),c.axisY.call(Xg),c.axisY2.call(Yg),c.axisSubX.call(Zg),Jb(H),L&&hb.length)if(Rh&&ab){for(bb=1;bb=0&&Zf.select(this).style("display",b%cb?"none":"block")})}else Vj.selectAll("."+g.axisX+" .tick text").style("display","block");!Kh&&Wh&&kb(Fj.x,c.axisX,Wh),P=kf(db,!1),S=mf(eb),U=lf(fb,!1),X=nf(eb,!0),Y=nf(eb,!1),Ug.domain(Rg.domain()),Vg.domain(Sg.domain()),$j.style("display","none"),q(),Xj.select("line."+g.xgridFocus).style("visibility","hidden"),ti&&(f=$d(ui,Qg),C=rj?Wg.tickOffset():0,e=Kh?{x1:0,x2:tg,y1:function(a){return Qg(a)-C},y2:function(a){return Qg(a)-C}}:{x1:function(a){return Qg(a)+C},x2:function(a){return Qg(a)+C},y1:qg.top,y2:vg},d=Xj.select("."+g.xgrids).selectAll("."+g.xgrid).data(f),d.enter().append("line").attr("class",g.xgrid),d.attr(e).style("opacity",function(){return+Zf.select(this).attr(Kh?"y1":"x1")===(Kh?vg:0)?0:1}),d.exit().remove()),Le(vi)&&(h=Xj.select("."+g.xgridLines).selectAll("."+g.xgridLine).data(vi),i=h.enter().append("g").attr("class",function(a){return g.xgridLine+(a.class?a.class:"")}),i.append("line").style("opacity",0),i.append("text").attr("text-anchor","end").attr("transform",Kh?"":"rotate(-90)").attr("dx",Kh?0:-qg.top).attr("dy",-5).style("opacity",0),h.select("line").transition().duration(Z).attr("x1",Kh?0:Kd).attr("x2",Kh?tg:Kd).attr("y1",Kh?Kd:qg.top).attr("y2",Kh?Kd:vg).style("opacity",1),h.select("text").transition().duration(Z).attr("x",Kh?tg:0).attr("y",Kd).text(function(a){return a.text}).style("opacity",1),h.exit().transition().duration(Z).style("opacity",0).remove()),F&&wi&&(j=Xj.select("."+g.ygrids).selectAll("."+g.ygrid).data(Rg.ticks(yi)),j.enter().append("line").attr("class",g.ygrid),j.attr("x1",Kh?Rg:0).attr("x2",Kh?Rg:tg).attr("y1",Kh?0:Rg).attr("y2",Kh?vg:Rg),j.exit().remove(),Cf(j,"grid")),F&&Le(xi)&&(k=Xj.select("."+g.ygridLines).selectAll("."+g.ygridLine).data(xi),l=k.enter().append("g").attr("class",function(a){return g.ygridLine+(a.class?a.class:"")}),l.append("line").style("opacity",0),l.append("text").attr("text-anchor","end").attr("transform",Kh?"rotate(-90)":"").attr("dx",Kh?0:-qg.top).attr("dy",-5).style("opacity",0),k.select("line").transition().duration(Z).attr("x1",Kh?Ld:0).attr("x2",Kh?Ld:tg).attr("y1",Kh?0:Ld).attr("y2",Kh?vg:Ld).style("opacity",1),k.select("text").transition().duration(Z).attr("x",Kh?0:tg).attr("y",Ld).text(function(a){return a.text}).style("opacity",1),k.exit().transition().duration(Z).style("opacity",0).remove()),u=Xj.select("."+g.regions).selectAll("."+g.region).data(cj),u.enter().append("g").attr("class",ld).append("rect").style("fill-opacity",0),u.selectAll("rect").transition().duration(Z).attr("x",jc).attr("y",kc).attr("width",lc).attr("height",mc).style("fill-opacity",function(a){return b(a.opacity)?a.opacity:.1}),u.exit().transition().duration(Z).style("opacity",0).remove(),s=Xj.selectAll("."+g.bars).selectAll("."+g.bar).data(Ae),s.enter().append("path").attr("class",fd).style("stroke",function(a){return zj(a.id)}).style("fill",function(a){return zj(a.id)}),s.style("opacity",xd).transition().duration(Z).attr("d",S).style("fill",zj).style("opacity",1),s.exit().transition().duration($).style("opacity",0).remove(),m=Xj.selectAll("."+g.lines).selectAll("."+g.line).data(ye),m.enter().append("path").attr("class",bd).style("stroke",zj),m.style("opacity",xd).transition().duration(Z).attr("d",U).style("stroke",zj).style("opacity",1),m.exit().transition().duration($).style("opacity",0).remove(),n=Xj.selectAll("."+g.areas).selectAll("."+g.area).data(ye),n.enter().append("path").attr("class",jd).style("fill",zj).style("opacity",function(){return bk=+Zf.select(this).style("opacity"),0}),n.style("opacity",0).transition().duration(Z).attr("d",P).style("fill",zj).style("opacity",bk),n.exit().transition().duration($).style("opacity",0).remove(),zi&&(r=Xj.selectAll("."+g.circles).selectAll("."+g.circle).data(Be),r.enter().append("circle").attr("class",dd).attr("r",af).style("fill",zj),r.style("opacity",xd).transition().duration(Z).style("opacity",zd).style("fill",zj).attr("cx",Kh?ee:de).attr("cy",Kh?de:ee),r.exit().remove()),Bd()&&(v=Xj.selectAll("."+g.texts).selectAll("."+g.text).data(Ce),v.enter().append("text").attr("class",Zc).attr("text-anchor",function(a){return Kh?a.value<0?"end":"start":"middle"}).style("stroke","none").style("fill",zj).style("fill-opacity",0),v.text(function(a){return Id(a.id)(a.value,a.id)}).style("fill-opacity",yd).transition().duration(Z).attr("x",X).attr("y",Y).style("fill",zj).style("fill-opacity",Ad),v.exit().transition().duration($).style("fill-opacity",0).remove()),t=Xj.selectAll("."+g.arcs).selectAll("."+g.arc).data(ze),t.enter().append("path").attr("class",hd).style("fill",function(a){return zj(a.data)}).style("cursor",function(a){return rh(a)?"pointer":null}).style("opacity",0).each(function(a){ve(a.data)&&(a.startAngle=a.endAngle=-1*(Math.PI/2)),this._current=a}).on("mouseover",function(a,b){var c,d,e;xj||(c=Kb(a),d=Qb(c),e=Yb(),Sb(c.data.id),Qf(c.data.id,!0),e(d,b))}).on("mousemove",function(a){var b=Kb(a),c=Qb(b),d=[c];Wd(d,Zf.mouse(this))}).on("mouseout",function(a,b){var c,d,e;xj||(c=Kb(a),d=Qb(c),e=Zb(),Tb(c.data.id),Rf(),Xd(),e(d,b))}).on("click",function(a,b){var c=Kb(a),d=Qb(c),e=Xb();yf(this,a,b),e(d,b)}),t.attr("transform",function(a){return!ve(a.data)&&K?"scale(0)":""}).style("opacity",function(a){return a===this._current?0:1}).each(function(){xj=!0}).transition().duration(Z).attrTween("d",function(a){var b,c=Kb(a);return c?(isNaN(this._current.endAngle)&&(this._current.endAngle=this._current.startAngle),b=Zf.interpolate(this._current,c),this._current=b(0),function(a){return Nb(b(a),!0)}):function(){return"M 0 0"}}).attr("transform",K?"scale(1)":"").style("fill",function(a){return Aj?Aj(a.data.values[0].value):zj(a.data.id)}).style("opacity",1).call(Oe,function(){xj=!1}),t.exit().transition().duration($).style("opacity",0).remove(),Xj.selectAll("."+g.chartArc).select("text").style("opacity",0).attr("class",function(a){return ve(a.data)?g.gaugeValue:""}).text(Rb).attr("transform",Ob).transition().duration(Z).style("opacity",function(a){return Kc(a.data.id)&&xe(a.data)?1:0}),Xj.select("."+g.chartArcsTitle).style("opacity",me($f.data.targets)||le($f.data.targets)?1:0),Ah&&(Zf.event&&"zoom"===Zf.event.type&&Tj.extent(Qg.orgDomain()).update(),G&&(!Kh&&Wh&&kb(Fj.subx,c.axisSubX,Wh),Tj.empty()||Tj.extent(Qg.orgDomain()).update(),R=kf(db,!0),T=mf(eb,!0),V=lf(fb,!0),y=Yj.selectAll("."+g.bars).selectAll("."+g.bar).data(Ae),y.enter().append("path").attr("class",fd).style("stroke","none").style("fill",zj),y.style("opacity",xd).transition().duration(Z).attr("d",T).style("opacity",1),y.exit().transition().duration(Z).style("opacity",0).remove(),w=Yj.selectAll("."+g.lines).selectAll("."+g.line).data(ye),w.enter().append("path").attr("class",bd).style("stroke",zj),w.style("opacity",xd).transition().duration(Z).attr("d",V).style("opacity",1),w.exit().transition().duration(Z).style("opacity",0).remove(),x=Yj.selectAll("."+g.areas).selectAll("."+g.area).data(ye),x.enter().append("path").attr("class",jd).style("fill",zj).style("opacity",function(){return bk=+Zf.select(this).style("opacity"),0}),x.style("opacity",0).transition().duration(Z).attr("d",R).style("fill",zj).style("opacity",bk),x.exit().transition().duration($).style("opacity",0).remove())),Xj.selectAll("."+g.selectedCircles).filter(function(a){return se(a)}).selectAll("circle").remove(),Xj.selectAll("."+g.selectedCircle).transition().duration(Z).attr("cx",Kh?ee:de).attr("cy",Kh?de:ee),kg&&(z=Xj.select("."+g.eventRects),Le(_g)&&!tc(_g)?(z.classed(g.eventRectsMultiple)||z.classed(g.eventRectsMultiple,!0).classed(g.eventRectsSingle,!1).selectAll("."+g.eventRect).remove(),A=Xj.select("."+g.eventRects).selectAll("."+g.eventRect).data([0]),xf(A.enter()),A.attr("x",0).attr("y",0).attr("width",tg).attr("height",vg)):(z.classed(g.eventRectsSingle)||z.classed(g.eventRectsMultiple,!1).classed(g.eventRectsSingle,!0).selectAll("."+g.eventRect).remove(),!sj&&!qj||rj?(E=Q(),D=function(a){return Qg(a.x)-E/2}):(E=function(a,b){var c=Cc(b),d=Dc(b),e=$f.data.xs[a.id][b],f=Qg(d?d:e),g=Qg(c?c:e);return(f-g)/2},D=function(a,b){var c=Cc(b),d=$f.data.xs[a.id][b];return(Qg(d)+Qg(c?c:d))/2}),B=Fc($f.data.targets),Xj.select("."+g.eventRects).datum(B?B.values:[]),A=Xj.select("."+g.eventRects).selectAll("."+g.eventRect).data(function(a){return a}),wf(A.enter()),A.attr("class",md).attr("x",Kh?0:D).attr("y",Kh?D:0).attr("width",Kh?tg:E).attr("height",Kh?E:vg),A.exit().remove())),Hc($f.data.targets).forEach(function(a){ck[a]=!0})}function Ef(){Df({withTransition:!1,withY:!1,withSubchart:!1,withUpdateXDomain:!0})}function Ff(){if(0!==Mc($f.data.targets).length){if("mousemove"===Zf.event.sourceEvent.type&&Uj.altDomain)return Qg.domain(Uj.altDomain),void Uj.scale(Qg).updateScaleExtent();rj&&Qg.orgDomain()[0]===ak[0]&&Qg.domain([ak[0]-1e-10,Qg.orgDomain()[1]]),Df({withTransition:!1,withY:!1,withSubchart:!1}),"mousemove"===Zf.event.sourceEvent.type&&(vj=!0)}}function Gf(){function a(){b.forEach(function(a){a()})}var b=[];return a.add=function(a){b.push(a)},a}function Hf(){Vj.attr("width",xg).attr("height",yg),Vj.select("#"+kj).select("rect").attr("width",tg).attr("height",vg),Vj.select("#"+lj).select("rect").attr("x",G).attr("y",H).attr("width",M).attr("height",N),Vj.select("#"+mj).select("rect").attr("x",I).attr("y",J).attr("width",O).attr("height",P),Vj.select("."+g.zoomRect).attr("width",tg).attr("height",vg),_j.style("max-height",yg+"px")}function If(a){return{axisX:a?Fj.x.transition().duration(a):Fj.x,axisY:a?Fj.y.transition().duration(a):Fj.y,axisY2:a?Fj.y2.transition().duration(a):Fj.y2,axisSubX:a?Fj.subx.transition().duration(a):Fj.subx}}function Jf(a){var b;a=a||{},a.withTransition=Pe(a,"withTransition",!0),a.withTransform=Pe(a,"withTransform",!1),a.withLegend=Pe(a,"withLegend",!1),a.withUpdateXDomain=!0,a.withUpdateOrgXDomain=!0,a.withTransitionForExit=!1,a.withLegend&&Eh||(b=If(a.withTransitionForAxis?pg:0),p(),W(),Hf(),o(a.withTransition,b)),Df(a,b)}function Kf(a){var b,c,d,e,f,h,i,j,k,l,m,n;i=Xj.select("."+g.chartTexts).selectAll("."+g.chartText).data(a).attr("class",od),j=i.enter().append("g").attr("class",od).style("opacity",0).style("pointer-events","none"),j.append("g").attr("class",$c),e=Xj.select("."+g.chartBars).selectAll("."+g.chartBar).data(a).attr("class",qd),d=e.enter().append("g").attr("class",qd).style("opacity",0).style("pointer-events","none"),d.append("g").attr("class",gd).style("cursor",function(a){return rh(a)?"pointer":null}),c=Xj.select("."+g.chartLines).selectAll("."+g.chartLine).data(a).attr("class",pd),b=c.enter().append("g").attr("class",pd).style("opacity",0).style("pointer-events","none"),b.append("g").attr("class",cd),b.append("g").attr("class",kd),b.append("g").attr("class",function(a){return Yc(g.selectedCircles,a.id)}),b.append("g").attr("class",ed).style("cursor",function(a){return rh(a)?"pointer":null}),a.forEach(function(a){Xj.selectAll("."+g.selectedCircles+sd(a.id)).selectAll("."+g.selectedCircle).each(function(b){b.value=a.values[b.index].value})}),h=Xj.select("."+g.chartArcs).selectAll("."+g.chartArc).data(Hg(a)).attr("class",rd),f=h.enter().append("g").attr("class",rd),f.append("g").attr("class",id),f.append("text").attr("dy",le($f.data.targets)?"-0.35em":".35em").style("opacity",0).style("text-anchor","middle").style("pointer-events","none"),Ah&&(n=Yj.select("."+g.chartBars).selectAll("."+g.chartBar).data(a).attr("class",qd),m=n.enter().append("g").style("opacity",0).attr("class",qd),m.append("g").attr("class",gd),l=Yj.select("."+g.chartLines).selectAll("."+g.chartLine).data(a).attr("class",pd),k=l.enter().append("g").style("opacity",0).attr("class",pd),k.append("g").attr("class",cd),k.append("g").attr("class",kd)),Vj.selectAll("."+g.target).filter(function(a){return Kc(a.id)}).transition().duration(pg).style("opacity",1)}function Lf(a,b){b.filter&&(a=a.filter(b.filter)),(b.type||b.types)&&a.forEach(function(a){b.types?ge(a.id,b.types[a.id]):ge(a.id,b.type)}),$f.data.targets.forEach(function(b){for(var c=0;cf&&(f=(m-l)/2,z=0,F++)),E[a]=F,D[F]=f,A[a]=z,z+=l}var f,h,i=Re(b.textContent,g.legendItem),j=10*Math.ceil((i.width+v)/10),k=10*Math.ceil((i.height+u)/10),l=Lj?k:j,m=Lj?V():U();return d&&(z=0,F=0,w=0,x=0),Eh&&!Lc(c)?void(B[c]=C[c]=E[c]=A[c]=0):(B[c]=j,C[c]=k,(!w||j>=w)&&(w=j),(!x||k>=x)&&(x=k),h=Lj?x:w,void(Jh?(Object.keys(B).forEach(function(a){B[a]=w}),Object.keys(C).forEach(function(a){C[a]=x}),f=(m-h*a.length)/2,y>f?(z=0,F=0,a.forEach(function(a){e(a)})):e(c,!0)):e(c)))}var f,h,i,j,k,l,m,n,q,r,s,t,u=4,v=36,w=0,x=0,y=10,z=0,A={},B={},C={},D=[0],E={},F=0,G=Zj.selectAll("."+g.legendItemFocused).size();b=b||{},n=Pe(b,"withTransition",!0),q=Pe(b,"withTransitionForTransform",!0),Lj?(f=function(a){return w*E[a]},j=function(a){return D[E[a]]+A[a]}):(f=function(a){return D[E[a]]+A[a]},j=function(a){return x*E[a]}),h=function(a,b){return f(a,b)+14},k=function(a,b){return j(a,b)+9},i=function(a,b){return f(a,b)-4},l=function(a,b){return j(a,b)-7},m=Zj.selectAll("."+g.legendItem).data(a).enter().append("g").attr("class",function(a){return Yc(g.legendItem,a)}).style("visibility",function(a){return Lc(a)?"visible":"hidden"}).style("cursor","pointer").on("click",function(a){"function"==typeof Gh?Gh(a):$f.toggle(a)}).on("mouseover",function(a){Zf.select(this).classed(g.legendItemFocused,!0),xj||$f.focus(a),"function"==typeof Hh&&Hh(a)}).on("mouseout",function(a){Zf.select(this).classed(g.legendItemFocused,!1),xj||$f.revert(),"function"==typeof Ih&&Ih(a)}),m.append("text").text(function(a){return d(ch[a])?ch[a]:a}).each(function(a,b){e(this,a,0===b)}).style("pointer-events","none").attr("x",Lj?h:-200).attr("y",Lj?-200:k),m.append("rect").attr("class",g.legendItemEvent).style("fill-opacity",0).attr("x",Lj?i:-200).attr("y",Lj?-200:l),m.append("rect").attr("class",g.legendItemTile).style("pointer-events","none").style("fill",zj).attr("x",Lj?h:-200).attr("y",Lj?-200:j).attr("width",10).attr("height",10),r=Zj.selectAll("text").data(a).text(function(a){return d(ch[a])?ch[a]:a}).each(function(a,b){e(this,a,0===b)}),(n?r.transition():r).attr("x",h).attr("y",k),s=Zj.selectAll("rect."+g.legendItemEvent).data(a),(n?s.transition():s).attr("width",function(a){return B[a]}).attr("height",function(a){return C[a]}).attr("x",i).attr("y",l),t=Zj.selectAll("rect."+g.legendItemTile).data(a),(n?t.transition():t).style("fill",zj).attr("x",f).attr("y",j),Zj.selectAll("."+g.legendItem).classed(g.legendItemHidden,function(a){return!Kc(a)}).transition().style("opacity",function(a){var b=Zf.select(this);return Kc(a)?!G||b.classed(g.legendItemFocused)?Of(b):Pf(b):Pj}),S(w),T(x),R(F),p(),W(),Hf(),o(q,c)}function Vf(a){return Jc($f.data.targets,a.id)}function Wf(a){return"data"in a&&Jc($f.data.targets,a.data.id)}function Xf(a){var b=a&&a.value?a.value:null,c=a&&a["class"]?a["class"]:null;return b?function(a){return a.value!==b}:c?function(a){return a["class"]!==c}:function(){return!0}}function Yf(a,b,c){var d=!ne($f.data.targets);xj=!1,ge(a,b),Jf(c||{withTransitionForAxis:d})}var Zf=a.d3?a.d3:"undefined"!=typeof require?require("d3"):void 0,$f={data:{},axis:{},legend:{}},_f={},ag=i(["bindto"],"#chart"),bg=i(["size","width"]),cg=i(["size","height"]),dg=i(["padding","left"]),eg=i(["padding","right"]),fg=i(["padding","top"]),gg=i(["padding","bottom"]),hg=i(["zoom","enabled"],!1),ig=i(["zoom","extent"]),jg=i(["zoom","privileged"],!1),kg=i(["interaction","enabled"],!0),lg=i(["onenter"],function(){}),mg=i(["onleave"],function(){}),ng=i(["onresize"],function(){}),og=i(["onresized"],function(){}),pg=i(["transition","duration"],350);h("data","data is required in config");var qg,rg,sg,tg,ug,vg,wg,xg,yg,zg,Ag,Bg,Cg,Dg,Eg,Fg,Gg,Hg,Ig,Jg,Kg,Lg,Mg,Ng,Og,Pg,Qg,Rg,Sg,Tg,Ug,Vg,Wg,Xg,Yg,Zg,$g=i(["data","x"]),_g=i(["data","xs"],{}),ah=i(["data","x_format"]),bh=i(["data","id_converter"],function(a){return a }),ch=i(["data","names"],{}),dh=i(["data","classes"],{}),eh=i(["data","groups"],[]),fh=i(["data","axes"],{}),gh=i(["data","type"]),hh=i(["data","types"],{}),ih=i(["data","labels"],{}),jh=i(["data","order"]),kh=i(["data","regions"],{}),lh=i(["data","color"]),mh=i(["data","colors"],{}),nh=i(["data","hide"],!1),oh=i(["data","filter"]),ph=i(["data","selection","enabled"],!1),qh=i(["data","selection","grouped"],!1),rh=i(["data","selection","isselectable"],function(){return!0}),sh=i(["data","selection","multiple"],!0),th=i(["data","onclick"],function(){}),uh=i(["data","onenter"],function(){}),vh=i(["data","onleave"],function(){}),wh=i(["data","onselected"],function(){}),xh=i(["data","onunselected"],function(){}),yh=i(["data","ondragstart"],function(){}),zh=i(["data","ondragend"],function(){}),Ah=i(["subchart","show"],!1),Bh=i(["subchart","size","height"],60),Ch=i(["color","pattern"],[]),Dh=i(["color","threshold"],{}),Eh=i(["legend","show"],!0),Fh=i(["legend","position"],"bottom"),Gh=i(["legend","item","onclick"]),Hh=i(["legend","item","onmouseover"]),Ih=i(["legend","item","onmouseout"]),Jh=i(["legend","equally"],!1),Kh=i(["axis","rotated"],!1),Lh=i(["axis","x","show"],!0),Mh=i(["axis","x","type"],"indexed"),Nh=i(["axis","x","localtime"],!0),Oh=i(["axis","x","categories"],[]),Ph=i(["axis","x","tick","centered"],!1),Qh=i(["axis","x","tick","format"]),Rh=i(["axis","x","tick","culling"],{}),Sh=i(["axis","x","tick","culling","max"],10),Th=i(["axis","x","tick","count"]),Uh=i(["axis","x","tick","fit"],!0),Vh=i(["axis","x","tick","values"],null),Wh=i(["axis","x","tick","rotate"]),Xh=i(["axis","x","max"],null),Yh=i(["axis","x","min"],null),Zh=i(["axis","x","padding"],{}),$h=i(["axis","x","height"]),_h=i(["axis","x","default"]),ai=i(["axis","x","label"],{}),bi=i(["axis","y","show"],!0),ci=i(["axis","y","max"]),di=i(["axis","y","min"]),ei=i(["axis","y","center"]),fi=i(["axis","y","label"],{}),gi=i(["axis","y","inner"],!1),hi=i(["axis","y","tick","format"]),ii=i(["axis","y","padding"]),ji=i(["axis","y","ticks"],10),ki=i(["axis","y2","show"],!1),li=i(["axis","y2","max"]),mi=i(["axis","y2","min"]),ni=i(["axis","y2","center"]),oi=i(["axis","y2","label"],{}),pi=i(["axis","y2","inner"],!1),qi=i(["axis","y2","tick","format"]),ri=i(["axis","y2","padding"]),si=i(["axis","y2","ticks"],10),ti=i(["grid","x","show"],!1),ui=i(["grid","x","type"],"tick"),vi=i(["grid","x","lines"],[]),wi=i(["grid","y","show"],!1),xi=i(["grid","y","lines"],[]),yi=i(["grid","y","ticks"],10),zi=i(["point","show"],!0),Ai=i(["point","r"],2.5),Bi=i(["point","focus","line","enabled"],!0),Ci=i(["point","focus","expand","enabled"],!0),Di=i(["point","focus","expand","r"]),Ei=i(["point","focus","select","r"]),Fi=i(["line","connect_null"],!1),Gi=i(["bar","width"]),Hi=i(["bar","width","ratio"],.6),Ii=i(["pie","label","show"],!0),Ji=i(["pie","label","format"]),Ki=i(["pie","expand"],!0),Li=i(["pie","onclick"],function(){}),Mi=i(["pie","onmouseover"],function(){}),Ni=i(["pie","onmouseout"],function(){}),Oi=i(["gauge","label","show"],!0),Pi=i(["gauge","label","format"]),Qi=i(["gauge","min"],0),Ri=i(["gauge","max"],100),Si=i(["gauge","onclick"],function(){}),Ti=i(["gauge","onmouseover"],function(){}),Ui=i(["gauge","onmouseout"],function(){}),Vi=i(["gauge","units"]),Wi=i(["gauge","width"]),Xi=i(["donut","label","show"],!0),Yi=i(["donut","label","format"]),Zi=i(["donut","expand"],!0),$i=i(["donut","title"],""),_i=i(["donut","onclick"],function(){}),aj=i(["donut","onmouseover"],function(){}),bj=i(["donut","onmouseout"],function(){}),cj=i(["regions"],[]),dj=i(["tooltip","show"],!0),ej=i(["tooltip","format","title"]),fj=i(["tooltip","format","value"]),gj=i(["tooltip","contents"],function(a,b,c,d){var e,f,h,i,j,k,l=ej?ej:b,m=fj?fj:c;for(f=0;f"+(h||0===h?""+h+"":"")),j=a[f].name,i=m(a[f].value,a[f].ratio,a[f].id,a[f].index),k=Aj?Aj(a[f].value):d(a[f].id),e+="",e+=""+j+"",e+=""+i+"",e+="");return e+""}),hj=i(["tooltip","init","show"],!1),ij=i(["tooltip","init","x"],0),jj=i(["tooltip","init","position"],{top:"0px",left:"50px"}),kj="c3-"+ +new Date+"-clip",lj=kj+"-xaxis",mj=kj+"-yaxis",nj=j(kj),oj=j(lj),pj=j(mj),qj="timeseries"===Mh,rj="categorized"===Mh,sj=!qj&&($g||Le(_g)),tj=null,uj=!1,vj=!1,wj=!1,xj=!1,yj=Zf.scale.category10().range(),zj=Ee(mh,Le(Ch)?Ch:yj,lh),Aj=Le(Dh)?Fe(Ch,Dh):null,Bj=Nh?Zf.time.format:Zf.time.format.utc,Cj=Bj.multi([[".%L",function(a){return a.getMilliseconds()}],[":%S",function(a){return a.getSeconds()}],["%I:%M",function(a){return a.getMinutes()}],["%I %p",function(a){return a.getHours()}],["%-m/%-d",function(a){return a.getDay()&&1!==a.getDate()}],["%-m/%-d",function(a){return 1!==a.getDate()}],["%-m/%-d",function(a){return a.getMonth()}],["%Y/%-m/%-d",function(){return!0}]]),Dj=[],Ej=[],Fj={},Gj=Kh?"left":"bottom",Hj=Kh?gi?"top":"bottom":gi?"right":"left",Ij=Kh?pi?"bottom":"top":pi?"left":"right",Jj=Kh?"left":"bottom",Kj={main:function(){return"translate("+k(qg.left)+","+k(qg.top)+")"},context:function(){return"translate("+k(rg.left)+","+k(rg.top)+")"},legend:function(){return"translate("+sg.left+","+sg.top+")"},x:function(){return"translate(0,"+(Kh?0:vg)+")"},y:function(){return"translate(0,"+(Kh?vg:0)+")"},y2:function(){return"translate("+(Kh?0:tg)+","+(Kh?1:0)+")"},subx:function(){return"translate(0,"+(Kh?0:wg)+")"},arc:function(){return"translate("+Cg/2+","+Dg/2+")"}},Lj="right"===Fh,Mj=0,Nj=0,Oj=0,Pj=.15,Qj=30,Rj=Kh&&!Lh?0:30,Sj=5;Hg=Zf.layout.pie().value(function(a){return a.values.reduce(function(a,b){return a+b.value},0)});var Tj,Uj=function(){};Tj=Zf.svg.brush().on("brush",Ef),Tj.update=function(){return Yj&&Yj.select("."+g.brush).call(this),this},Tj.scale=function(a){return Kh?this.y(a):this.x(a)},hg&&(Uj=Zf.behavior.zoom().on("zoomstart",function(){Uj.altDomain=Zf.event.sourceEvent.altKey?Qg.orgDomain():null}).on("zoom",hg?Ff:null),Uj.scale=function(a){return Kh?this.y(a):this.x(a)},Uj.orgScaleExtent=function(){var a=ig?ig:[1,10];return[a[0],Math.max(Ec()/a[1],a[1])]},Uj.updateScaleExtent=function(){var a=fc(Qg.orgDomain())/fc(ak),b=this.orgScaleExtent();return this.scaleExtent([b[0]*a,b[1]*a]),this});var Vj,Wj,Xj,Yj,Zj,$j,_j,ak,bk,ck={};if($f.focus=function(a){function b(a){Mc(a).transition().duration(100).style("opacity",1)}var c=Vj.selectAll(td(a)),d=c.filter(Vf),e=c.filter(Wf);$f.revert(),$f.defocus(),b(d.classed(g.focused,!0)),b(e),ne($f.data.targets)&&Sb(a,!0),Qf(a,!0)},$f.defocus=function(a){function b(a){Mc(a).transition().duration(100).style("opacity",.3)}var c=Vj.selectAll(td(a)),d=c.filter(Vf),e=c.filter(Wf);$f.revert(),b(d.classed(g.focused,!1)),b(e),ne($f.data.targets)&&Tb(a),Qf(a,!1)},$f.revert=function(a){function b(a){Mc(a).transition().duration(100).style("opacity",1)}var c=Vj.selectAll(td(a)),d=c.filter(Vf),e=c.filter(Wf);b(d.classed(g.focused,!1)),b(e),ne($f.data.targets)&&Tb(a),Rf()},$f.show=function(a,b){a=Ic(a),b=b||{},Qc(a),Vj.selectAll(ud(a)).transition().style("opacity",1),b.withLegend&&Sf(a),Df({withUpdateOrgXDomain:!0,withUpdateXDomain:!0,withLegend:!0})},$f.hide=function(a,b){a=Ic(a),b=b||{},Pc(a),Vj.selectAll(ud(a)).transition().style("opacity",0),b.withLegend&&Tf(a),Df({withUpdateOrgXDomain:!0,withUpdateXDomain:!0,withLegend:!0})},$f.toggle=function(a){Kc(a)?$f.hide(a):$f.show(a)},$f.unzoom=function(){Tj.clear().update(),Df({withUpdateXDomain:!0})},$f.load=function(a){return a.xs&&sc(a.xs),"classes"in a&&Object.keys(a.classes).forEach(function(b){dh[b]=a.classes[b]}),"categories"in a&&rj&&(Oh=a.categories,Wg.categories(Oh)),"cacheIds"in a&&gc(a.cacheIds)?void Lf(ic(a.cacheIds),a.done):void("unload"in a?Nf(Ic("boolean"==typeof a.unload&&a.unload?null:a.unload),function(){Mf(a)}):Mf(a))},$f.unload=function(a,b){Nf(Ic(a),function(){Df({withUpdateOrgXDomain:!0,withUpdateXDomain:!0,withLegend:!0}),"function"==typeof b&&b()})},$f.selected=function(a){return Zf.merge(Xj.selectAll("."+g.shapes+sd(a)).selectAll("."+g.shape).filter(function(){return Zf.select(this).classed(g.SELECTED)}).map(function(a){return a.map(function(a){var b=a.__data__;return b.data?b.data:b})}))},$f.select=function(a,b,c){ph&&Xj.selectAll("."+g.shapes).selectAll("."+g.shape).each(function(e,f){var h=Zf.select(this),i=e.data?e.data.id:e.id,j=$e(this),k=qh||!a||a.indexOf(i)>=0,l=!b||b.indexOf(f)>=0,m=h.classed(g.SELECTED);h.classed(g.line)||h.classed(g.area)||(k&&l?rh(e)&&!m&&j(!0,h.classed(g.SELECTED,!0),e,f):d(c)&&c&&m&&j(!1,h.classed(g.SELECTED,!1),e,f))})},$f.unselect=function(a,b){ph&&Xj.selectAll("."+g.shapes).selectAll("."+g.shape).each(function(c,d){var e=Zf.select(this),f=c.data?c.data.id:c.id,h=$e(this),i=qh||!a||a.indexOf(f)>=0,j=!b||b.indexOf(d)>=0,k=e.classed(g.SELECTED);e.classed(g.line)||e.classed(g.area)||i&&j&&rh(c)&&k&&h(!1,e.classed(g.SELECTED,!1),c,d)})},$f.toLine=function(a){Yf(a,"line")},$f.toSpline=function(a){Yf(a,"spline")},$f.toBar=function(a){Yf(a,"bar")},$f.toScatter=function(a){Yf(a,"scatter")},$f.toArea=function(a){Yf(a,"area")},$f.toAreaSpline=function(a){Yf(a,"area-spline")},$f.toPie=function(a){Yf(a,"pie",{withTransform:!0})},$f.toDonut=function(a){Yf(a,"donut",{withTransform:!0})},$f.groups=function(a){return c(a)?eh:(eh=a,Df(),eh)},$f.xgrids=function(a){return a?(vi=a,Df(),vi):vi},$f.xgrids.add=function(a){return a?$f.xgrids(vi.concat(a)):void 0},$f.xgrids.remove=function(a){var b=Xf(a);return $f.xgrids(vi.filter(b))},$f.ygrids=function(a){return a?(xi=a,Df(),xi):xi},$f.ygrids.add=function(a){return a?$f.ygrids(xi.concat(a)):void 0},$f.ygrids.remove=function(a){var b=Xf(a);return $f.ygrids(xi.filter(b))},$f.regions=function(a){return a?(cj=a,Df(),cj):cj},$f.regions.add=function(a){return a?(cj=cj.concat(a),Df(),cj):cj},$f.regions.remove=function(a){var b,c,d;return a=a||{},b=Pe(a,"duration",pg),c=Pe(a,"classes",[g.region]),d=Xj.select("."+g.regions).selectAll(c.map(function(a){return"."+a})),(b?d.transition().duration(b):d).style("opacity",0).remove(),cj=cj.filter(function(a){var b=!1;return a.class?(a.class.split(" ").forEach(function(a){c.indexOf(a)>=0&&(b=!0)}),!b):!0})},$f.data.get=function(a){var b=$f.data.getAsTarget(a);return d(b)?b.values.map(function(a){return a.value}):void 0},$f.data.getAsTarget=function(a){var b=$f.data.targets.filter(function(b){return b.id===a});return b.length>0?b[0]:void 0},$f.data.names=function(a){return arguments.length?(Object.keys(a).forEach(function(b){ch[b]=a[b]}),Df({withLegend:!0}),ch):ch},$f.data.colors=function(a){return arguments.length?(Object.keys(a).forEach(function(b){mh[b]=a[b]}),Df({withLegend:!0}),mh):mh},$f.x=function(a){return arguments.length&&(vc($f.data.targets,a),Df({withUpdateOrgXDomain:!0,withUpdateXDomain:!0})),$f.data.xs},$f.xs=function(a){return arguments.length&&(wc($f.data.targets,a),Df({withUpdateOrgXDomain:!0,withUpdateXDomain:!0})),$f.data.xs},$f.axis.labels=function(a){arguments.length&&(Object.keys(a).forEach(function(b){hb(b,a[b])}),Jb())},$f.axis.max=function(a){arguments.length&&("object"==typeof a?(b(a.x)&&(Xh=+a.x),b(a.y)&&(ci=+a.y),b(a.y2)&&(li=+a.y2)):ci=li=+a,Df({withUpdateOrgXDomain:!0,withUpdateXDomain:!0}))},$f.axis.min=function(a){arguments.length&&("object"==typeof a?(b(a.x)&&(Yh=+a.x),b(a.y)&&(di=+a.y),b(a.y2)&&(mi=+a.y2)):di=mi=+a,Df({withUpdateOrgXDomain:!0,withUpdateXDomain:!0}))},$f.axis.range=function(a){arguments.length&&("undefined"!=typeof a.max&&$f.axis.max(a.max),"undefined"!=typeof a.min&&$f.axis.min(a.min))},$f.legend.show=function(a){Sf(Ic(a)),Df({withLegend:!0})},$f.legend.hide=function(a){Tf(Ic(a)),Df({withLegend:!0})},$f.resize=function(a){bg=a?a.width:null,cg=a?a.height:null,$f.flush(),$f.flush()},$f.flush=function(){Jf({withLegend:!0,withTransition:!1,withTransitionForTransform:!1})},$f.destroy=function(){$f.data.targets=void 0,$f.data.xs={},_j.classed("c3",!1).html(""),a.onresize=null},"url"in f.data)Zf.xhr(f.data.url,function(a,b){var c,d=Zf.csv.parseRows(b.response);1===d.length?(c=[{}],d[0].forEach(function(a){c[0][a]=null})):c=Zf.csv.parse(b.response),vf(c)});else if("rows"in f.data)vf(yc(f.data.rows));else{if(!("columns"in f.data))throw Error("url or rows or columns is required.");vf(zc(f.data.columns))}return $f},"function"==typeof define&&define.amd?define("c3",["d3"],f):"undefined"!=typeof exports&&"undefined"!=typeof module?module.exports=f:a.c3=f}(window); \ No newline at end of file diff --git a/htdocs/samples/legend.html b/htdocs/samples/legend.html new file mode 100644 index 0000000..5936ce8 --- /dev/null +++ b/htdocs/samples/legend.html @@ -0,0 +1,61 @@ + + + + + +
+
+
+
+ + + + + +