Browse Source

Fix y domain max/min when undefined

pull/34/merge
Masayuki Tanaka 11 years ago
parent
commit
6ab3a456b9
  1. 16
      c3.js
  2. 32
      c3.min.js

16
c3.js

@ -445,12 +445,12 @@
if (__data_groups.length > 0) {
hasNegativeValue = hasNegativeValueInTargets(targets);
for (j = 0; j < __data_groups.length; j++) {
if (hasNegativeValue) {
ys[__data_groups[j][0]].forEach(function (v, i) {
ys[__data_groups[j][0]][i] = v < 0 ? v : 0;
baseId = __data_groups[j][0];
if (hasNegativeValue && ys[baseId]) {
ys[baseId].forEach(function (v, i) {
ys[baseId][i] = v < 0 ? v : 0;
});
}
baseId = __data_groups[j][0];
for (k = 1; k < __data_groups[j].length; k++) {
id = __data_groups[j][k];
if (! ys[id]) { continue; }
@ -469,12 +469,12 @@
if (__data_groups.length > 0) {
hasPositiveValue = hasPositiveValueInTargets(targets);
for (j = 0; j < __data_groups.length; j++) {
if (hasPositiveValue) {
ys[__data_groups[j][0]].forEach(function (v, i) {
ys[__data_groups[j][0]][i] = v > 0 ? v : 0;
baseId = __data_groups[j][0];
if (hasPositiveValue && ys[baseId]) {
ys[baseId].forEach(function (v, i) {
ys[baseId][i] = v > 0 ? v : 0;
});
}
baseId = __data_groups[j][0];
for (k = 1; k < __data_groups[j].length; k++) {
id = __data_groups[j][k];
if (! ys[id]) { continue; }

32
c3.min.js vendored

@ -9,20 +9,20 @@ d.svg.axis().scale(Y).orient(nd);fb=ac(U,od);jb=Ua();mc=ma();nc=ma(0.98)}functio
b])}function v(a){return"y2"===y(a)?Y:z}function H(a){return"y2"===y(a)?hb:gb}function ac(a,b){var c=(ea?jd():d.svg.axis()).scale(a).orient(b);c.tickFormat(bc());ea?c.categories(Fa).tickCentered(pd):c.tickOffset=function(){return 0};return c}function y(a){return a in oc?oc[a]:"y"}function bc(){var a=B?qd:ea?rd:function(a){return a};kb&&(a="function"===typeof kb?kb:B?function(a){return d.time.format(kb)(a)}:a);return a}function la(a){var b=!1;Db(g.data.targets).forEach(function(c){b||c.data.id!==a.data.id||
(b=!0,a=c)});return b?a:null}function Ua(){var a=d.svg.arc().outerRadius(db).innerRadius(0),b=function(b,e){var k;return e?a(b):(k=la(b))?a(k):"M 0 0"};b.centroid=a.centroid;return b}function ma(a){var b=d.svg.arc().outerRadius(Ab*(a?a:1)).innerRadius(0);return function(a){return(a=la(a))?b(a):"M 0 0"}}function Va(a){a=la(a);var b,c;b="";a&&(b=jb.centroid(a),a=b[0],b=b[1],c=Math.sqrt(a*a+b*b),b="translate("+0.8*(a/c)*db+","+0.8*(b/c)*db+")");return b}function Wa(a){return(100*(a.endAngle-a.startAngle)/
(2*Math.PI)).toFixed(1)+"%"}function Xa(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",mc).transition().duration(100).attr("d",nc);b||e.style("opacity",0.3)}function wb(a){p.selectAll(".chart-arc.target"+(a?"-"+a:"")).selectAll("path").transition().duration(50).attr("d",jb);p.selectAll(".-arc").style("opacity",1)}function sd(a){var b=pc(a),c,e,k,D;if(0<s.length)for(D=qc(a),
c=0;c<s.length;c++)for(D&&b[s[c][0]].forEach(function(a,e){b[s[c][0]][e]=0>a?a:0}),e=s[c][0],a=1;a<s[c].length;a++)k=s[c][a],b[k]&&b[k].forEach(function(a,c){y(k)!==y(e)||!b[e]||D&&0<+a||(b[e][c]+=+a)});return d.min(Object.keys(b).map(function(a){return d.min(b[a])}))}function td(a){var b=pc(a),c,e,k,D;if(0<s.length)for(D=ud(a),c=0;c<s.length;c++)for(D&&b[s[c][0]].forEach(function(a,e){b[s[c][0]][e]=0<a?a:0}),e=s[c][0],a=1;a<s[c].length;a++)k=s[c][a],b[k]&&b[k].forEach(function(a,c){y(k)!==y(e)||
!b[e]||D&&0>+a||(b[e][c]+=+a)});return d.max(Object.keys(b).map(function(a){return d.max(b[a])}))}function lb(a){var b=mb(function(b){return y(b.id)===a}),c="y2"===a?vd:wd,e="y2"===a?xd:yd,c=c?c:sd(b),e=e?e:td(b),k=0.1*Math.abs(e-c),d=k,f=k,g="y2"===a?zd:Ad;g&&(c=Math.max(Math.abs(c),Math.abs(e)),e=c-g,c=g-c);"y"===a&&Ga&&(d=Ga.top?Ga.top:k,f=Ga.bottom?Ga.bottom:k);"y2"===a&&Ha&&(d=Ha.top?Ha.top:k,f=Ha.bottom?Ha.bottom:k);Ia(b,"bar")&&!qc(b)&&(f=c);return[c-f,e+d]}function jc(a){var b;a?(a=m.domain(),
b=K.extent()):(a=V,b=m.domain());return(a[1]-a[0])/(b[1]-b[0])}function Bd(a){return d.min(a,function(a){return d.min(a.values,function(a){return a.x})})}function Cd(a){return d.max(a,function(a){return d.max(a.values,function(a){return a.x})})}function nb(a){var b=[Bd(a),Cd(a)];a=b[0];var b=b[1],c=ea?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 Dd(a){for(var b=0;b<a.length;b++)if(!(a[b]in ob))return!1;return!0}function Ed(a){for(var b=
[],c=0;c<a.length;c++)a[c]in ob&&b.push(rc(ob[a[c]]));return b}function Eb(a){return"start"in a?m(B?pa(a.start):a.start):0}function sc(a){var b=Eb(a);a=("end"in a?m(B?pa(a.end):a.end):q)-b;return 0>a?0:a}function tc(a){return qa&&a===qa||Z&&Fd(Z,a)}function Gd(a){return!tc(a)}function Hd(a){Object.keys(a).forEach(function(b){Z[b]=a[b]})}function pb(a){var b;a&&(b=Ja[a.id],a.name=b?b:a.id);return a}function uc(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 vc(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 Ka(a){var b=d.keys(a[0]).filter(Gd),c=d.keys(a[0]).filter(tc);if(B&&0===c.length)return P.alert('data.x or data.xs must be specified when axis.x.type == "timeseries"'),[];Fb&&b.forEach(function(b){var k=qa?qa:Z?Z[b]:null;0<=c.indexOf(k)?g.data.x[b]=a.map(function(a){return a[k]}):g.data.x[b]=g.data.x[Object.keys(g.data.x)[0]]});
b=b.map(function(b){var c=Id(b);return{id:c,id_org:b,values:a.map(function(a,d){var f;f=qa?qa:Z?Z[b]:null;f=B?pa(a[f]):Fb?a[f]?a[f]:b in g.data.x&&g.data.x[b]&&g.data.x[b][d]?g.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++})});b.forEach(function(a){ob[a.id_org]=rc(a)});return b}function rc(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 wc(a){return 0<a&&g.data.targets[0].values[a-1]?g.data.targets[0].values[a-1].x:void 0}function eb(){return d.max(g.data.targets,function(a){return a.values.length})}function Jd(){var a=g.data.targets.length,b=0,c;1<a?g.data.targets.forEach(function(a){a.values.length>b&&(c=a,b=a.values.length)}):c=a?g.data.targets[0]:null;return c}function qb(a){a=x(a)?g.data.targets:a;return a.map(function(a){return a.id})}
function xc(a){var b=qb(),c;for(c=0;c<b.length;c++)if(b[c]===a)return!0;return!1}function mb(a){return r(a)?g.data.targets.filter(a):g.data.targets}function pc(a){var b={};a.forEach(function(a){b[a.id]=[];a.values.forEach(function(e){b[a.id].push(e.value)})});return b}function yc(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 qc(a){return yc(a,function(a){return 0>a})}function ud(a){return yc(a,function(a){return 0<
a})}function rd(a){return a<Fa.length?Fa[a]:a}function La(a){return"-shapes -shapes-"+a.id}function zc(a){return La(a)+" -line -line-"+a.id}function Kd(a){return La(a)+" -circles -circles-"+a.id}function Ac(a){return La(a)+" -bars -bars-"+a.id}function Ld(a){return La(a.data)+" -arc -arc-"+a.data.id}function Md(a){return La(a)+" -area -area-"+a.id}function Nd(a,b){return"-shape -shape-"+b+" -circle -circle-"+b}function Bc(a,b){return"-shape -shape-"+b+" -bar -bar-"+b}function Od(a,b){return"region region-"+
b+" "+("classes"in a?[].concat(a.classes).join(" "):"")}function Cc(a,b){return"event-rect event-rect-"+b}function xa(a){return m(a.x)}function Ma(a){return m(B?pa(a.value):a.value)}function Dc(a){return z(a.value)}function Ec(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 Fc(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(Ec(a,c))),
a[e].x&&(k=k.concat(Ec(a,e))),Gc(k,b)):Fc(a,b,c,e)}function Hc(a,b){var c;c=a.map(function(a){return Fc(a.values,b)});return Gc(c,b)}function Gc(a,b){var c,e;a.forEach(function(a){var d=Gb(a,b);if(d<c||!c)c=d,e=a});return e}function Ic(a,b){var c,e,k,d,f;W.html(Jc(a)).style("visibility","hidden").style("display","block");c=W.property("offsetWidth");e=W.property("offsetHeight");l?d=b[0]:(k=p.property("offsetLeft"),d=k+(bb?bb:cb?1:40)+m(a[0].x)+20,f=d+c,k=k+(null===Ya?ba():Ya)-(Za?Za:zb?$a||l?1:40:
20),f>k&&(d-=c+30));c=b[1]+15+e<X()?b[1]+15:b[1]-e;W.style("top",c+"px").style("left",d+"px").style("visibility","visible")}function Kc(a){Ia(g.data.targets,"scatter")||C(g.data.targets)||h.selectAll("line.xgrid-focus").style("visibility","visible").data([a]).attr(l?"y1":"x1",xa).attr(l?"y2":"x2",xa)}function Lc(){h.select("line.xgrid-focus").style("visibility","hidden")}function fa(a){return a.x||0===a.x?m(a.x):null}function ga(a){return v(a.id)(a.value)}function Pd(){var a={},b=0,c,e;mb(rb).forEach(function(k){for(c=
0;c<s.length;c++)if(!(0>s[c].indexOf(k.id)))for(e=0;e<s[c].length;e++)if(s[c][e]in a){a[k.id]=a[s[c][e]];break}x(a[k.id])&&(a[k.id]=b++)});a.__max__=b-1;return a}function Qd(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 Rd(a){return function(b){return(a?H(b.id):v(b.id))(b.value)}}function Sd(a,b){var c=Object.keys(a);return function(e,k){var d=b?H(e.id):v(e.id),f=d(0),g=f;mb(rb).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 Na(a,b){var c=x(a)?qb():a;"string"===typeof c&&(c=[c]);for(var e=0;e<c.length;e++)E[c[e]]=b}function Ia(a,b){var c=!1;a.forEach(function(a){E[a.id]===b&&(c=!0);a.id in E||"line"!==b||(c=!0)});return c}function C(a){return Ia(a,"pie")}function Hb(a){a="string"===typeof a?a:a.id;return!(a in E)||"line"===E[a]||"spline"===E[a]||"area"===E[a]||"area-spline"===E[a]}function Mc(a){a=
a=0;a<s.length;a++)for(e=s[a][0],D&&b[e]&&b[e].forEach(function(a,c){b[e][c]=0>a?a:0}),c=1;c<s[a].length;c++)k=s[a][c],b[k]&&b[k].forEach(function(a,c){y(k)!==y(e)||!b[e]||D&&0<+a||(b[e][c]+=+a)});return d.min(Object.keys(b).map(function(a){return d.min(b[a])}))}function td(a){var b=pc(a),c,e,k,D;if(0<s.length)for(D=ud(a),a=0;a<s.length;a++)for(e=s[a][0],D&&b[e]&&b[e].forEach(function(a,c){b[e][c]=0<a?a:0}),c=1;c<s[a].length;c++)k=s[a][c],b[k]&&b[k].forEach(function(a,c){y(k)!==y(e)||!b[e]||D&&0>
+a||(b[e][c]+=+a)});return d.max(Object.keys(b).map(function(a){return d.max(b[a])}))}function lb(a){var b=mb(function(b){return y(b.id)===a}),c="y2"===a?vd:wd,e="y2"===a?xd:yd,c=c?c:sd(b),e=e?e:td(b),k=0.1*Math.abs(e-c),d=k,f=k,g="y2"===a?zd:Ad;g&&(c=Math.max(Math.abs(c),Math.abs(e)),e=c-g,c=g-c);"y"===a&&Ga&&(d=Ga.top?Ga.top:k,f=Ga.bottom?Ga.bottom:k);"y2"===a&&Ha&&(d=Ha.top?Ha.top:k,f=Ha.bottom?Ha.bottom:k);Ia(b,"bar")&&!qc(b)&&(f=c);return[c-f,e+d]}function jc(a){var b;a?(a=m.domain(),b=K.extent()):
(a=V,b=m.domain());return(a[1]-a[0])/(b[1]-b[0])}function Bd(a){return d.min(a,function(a){return d.min(a.values,function(a){return a.x})})}function Cd(a){return d.max(a,function(a){return d.max(a.values,function(a){return a.x})})}function nb(a){var b=[Bd(a),Cd(a)];a=b[0];var b=b[1],c=ea?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 Dd(a){for(var b=0;b<a.length;b++)if(!(a[b]in ob))return!1;return!0}function Ed(a){for(var b=[],c=0;c<a.length;c++)a[c]in
ob&&b.push(rc(ob[a[c]]));return b}function Eb(a){return"start"in a?m(B?pa(a.start):a.start):0}function sc(a){var b=Eb(a);a=("end"in a?m(B?pa(a.end):a.end):q)-b;return 0>a?0:a}function tc(a){return qa&&a===qa||Z&&Fd(Z,a)}function Gd(a){return!tc(a)}function Hd(a){Object.keys(a).forEach(function(b){Z[b]=a[b]})}function pb(a){var b;a&&(b=Ja[a.id],a.name=b?b:a.id);return a}function uc(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 vc(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 Ka(a){var b=d.keys(a[0]).filter(Gd),c=d.keys(a[0]).filter(tc);if(B&&0===c.length)return P.alert('data.x or data.xs must be specified when axis.x.type == "timeseries"'),[];Fb&&b.forEach(function(b){var k=qa?qa:Z?Z[b]:null;0<=c.indexOf(k)?g.data.x[b]=a.map(function(a){return a[k]}):g.data.x[b]=g.data.x[Object.keys(g.data.x)[0]]});b=b.map(function(b){var c=
Id(b);return{id:c,id_org:b,values:a.map(function(a,d){var f;f=qa?qa:Z?Z[b]:null;f=B?pa(a[f]):Fb?a[f]?a[f]:b in g.data.x&&g.data.x[b]&&g.data.x[b][d]?g.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++})});b.forEach(function(a){ob[a.id_org]=rc(a)});return b}function rc(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 wc(a){return 0<a&&g.data.targets[0].values[a-1]?g.data.targets[0].values[a-1].x:void 0}function eb(){return d.max(g.data.targets,function(a){return a.values.length})}function Jd(){var a=g.data.targets.length,b=0,c;1<a?g.data.targets.forEach(function(a){a.values.length>b&&(c=a,b=a.values.length)}):c=a?g.data.targets[0]:null;return c}function qb(a){a=x(a)?g.data.targets:a;return a.map(function(a){return a.id})}function xc(a){var b=
qb(),c;for(c=0;c<b.length;c++)if(b[c]===a)return!0;return!1}function mb(a){return r(a)?g.data.targets.filter(a):g.data.targets}function pc(a){var b={};a.forEach(function(a){b[a.id]=[];a.values.forEach(function(e){b[a.id].push(e.value)})});return b}function yc(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 qc(a){return yc(a,function(a){return 0>a})}function ud(a){return yc(a,function(a){return 0<a})}function rd(a){return a<
Fa.length?Fa[a]:a}function La(a){return"-shapes -shapes-"+a.id}function zc(a){return La(a)+" -line -line-"+a.id}function Kd(a){return La(a)+" -circles -circles-"+a.id}function Ac(a){return La(a)+" -bars -bars-"+a.id}function Ld(a){return La(a.data)+" -arc -arc-"+a.data.id}function Md(a){return La(a)+" -area -area-"+a.id}function Nd(a,b){return"-shape -shape-"+b+" -circle -circle-"+b}function Bc(a,b){return"-shape -shape-"+b+" -bar -bar-"+b}function Od(a,b){return"region region-"+b+" "+("classes"in
a?[].concat(a.classes).join(" "):"")}function Cc(a,b){return"event-rect event-rect-"+b}function xa(a){return m(a.x)}function Ma(a){return m(B?pa(a.value):a.value)}function Dc(a){return z(a.value)}function Ec(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 Fc(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(Ec(a,c))),a[e].x&&(k=k.concat(Ec(a,
e))),Gc(k,b)):Fc(a,b,c,e)}function Hc(a,b){var c;c=a.map(function(a){return Fc(a.values,b)});return Gc(c,b)}function Gc(a,b){var c,e;a.forEach(function(a){var d=Gb(a,b);if(d<c||!c)c=d,e=a});return e}function Ic(a,b){var c,e,k,d,f;W.html(Jc(a)).style("visibility","hidden").style("display","block");c=W.property("offsetWidth");e=W.property("offsetHeight");l?d=b[0]:(k=p.property("offsetLeft"),d=k+(bb?bb:cb?1:40)+m(a[0].x)+20,f=d+c,k=k+(null===Ya?ba():Ya)-(Za?Za:zb?$a||l?1:40:20),f>k&&(d-=c+30));c=b[1]+
15+e<X()?b[1]+15:b[1]-e;W.style("top",c+"px").style("left",d+"px").style("visibility","visible")}function Kc(a){Ia(g.data.targets,"scatter")||C(g.data.targets)||h.selectAll("line.xgrid-focus").style("visibility","visible").data([a]).attr(l?"y1":"x1",xa).attr(l?"y2":"x2",xa)}function Lc(){h.select("line.xgrid-focus").style("visibility","hidden")}function fa(a){return a.x||0===a.x?m(a.x):null}function ga(a){return v(a.id)(a.value)}function Pd(){var a={},b=0,c,e;mb(rb).forEach(function(k){for(c=0;c<
s.length;c++)if(!(0>s[c].indexOf(k.id)))for(e=0;e<s[c].length;e++)if(s[c][e]in a){a[k.id]=a[s[c][e]];break}x(a[k.id])&&(a[k.id]=b++)});a.__max__=b-1;return a}function Qd(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 Rd(a){return function(b){return(a?H(b.id):v(b.id))(b.value)}}function Sd(a,b){var c=Object.keys(a);return function(e,k){var d=b?H(e.id):v(e.id),f=d(0),g=f;mb(rb).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 Na(a,b){var c=x(a)?qb():a;"string"===typeof c&&(c=[c]);for(var e=0;e<c.length;e++)E[c[e]]=b}function Ia(a,b){var c=!1;a.forEach(function(a){E[a.id]===b&&(c=!0);a.id in E||"line"!==b||(c=!0)});return c}function C(a){return Ia(a,"pie")}function Hb(a){a="string"===typeof a?a:a.id;return!(a in E)||"line"===E[a]||"spline"===E[a]||"area"===E[a]||"area-spline"===E[a]}function Mc(a){a=
"string"===typeof a?a:a.id;return"spline"===E[a]||"area-spline"===E[a]}function rb(a){return"bar"===E["string"===typeof a?a:a.id]}function Nc(a){return"pie"===E["string"===typeof a?a:a.id]}function Oc(a){return rb(a)?a.values:[]}function Td(a){var b;(b=Hb(a))||(b="scatter"===E["string"===typeof a?a:a.id]);return b?a.values:[]}function pa(a){var b;if(!a)throw Error(a+" can not be parsed as d3.time with format "+Ib+". Maybe 'x' of this data is not defined. See data.x or data.xs option.");b=d.time.format(Ib).parse(a);
if(!b)throw Error("Failed to parse '"+a+"' with format "+Ib);return b}function Pc(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 Qc(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 Ud(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 Fd(a,b){var c=!1;Object.keys(a).forEach(function(e){a[e]===
b&&(c=!0)});return c}function Gb(a,b){return Math.pow(m(a.x)-b[0],2)+Math.pow(z(a.value)-b[1],2)}function Rc(a,b,c){Vd(a,b);h.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",l?ga:fa).attr("cy",l?fa:ga).attr("stroke",function(){return L(b.id)}).attr("r",1.4*Oa).transition().duration(100).attr("r",Oa)}function Jb(a,b,c){Wd(a,b);h.select(".selected-circles-"+b.id).selectAll(".selected-circle-"+
@ -68,8 +68,8 @@ bb=f(["padding","left"],null),Za=f(["padding","right"],null),ra=f(["zoom","enabl
"type"],null),E=f(["data","types"],{}),hd=f(["data","regions"],{}),ue=f(["data","colors"],{}),ha=f(["data","selection","enabled"],!1),sa=f(["data","selection","grouped"],!1),ia=f(["data","selection","isselectable"],function(){return!0}),za=f(["subchart","show"],!1),dc=za?f(["subchart","size","height"],60):0,ve=f(["color","pattern"],null),Ba=f(["legend","show"],!0),Sa=f(["legend","item","width"],80),te=f(["legend","item","onclick"],function(){}),id=f(["axis","x","type"],"indexed"),Fa=f(["axis","x",
"categories"],[]),pd=f(["axis","x","tick","centered"],!1),kb=f(["axis","x","tick","format"],null),ub=f(["axis","x","default"],null),ee=f(["axis","x","label"],null),yd=f(["axis","y","max"],null),wd=f(["axis","y","min"],null),Ad=f(["axis","y","center"],null),fe=f(["axis","y","label"],null),cb=f(["axis","y","inner"],!1),$d=f(["axis","y","tick","format"],function(a){return a}),Ga=f(["axis","y","padding"],null),Zd=f(["axis","y","ticks"],10),zb=f(["axis","y2","show"],!1),xd=f(["axis","y2","max"],null),
vd=f(["axis","y2","min"],null),zd=f(["axis","y2","center"],null),$a=f(["axis","y2","inner"],!1),be=f(["axis","y2","tick","format"],function(a){return a}),Ha=f(["axis","y2","padding"],null),ae=f(["axis","y2","ticks"],10),l=f(["axis","rotated"],!1),Wc=f(["grid","x","show"],!1),oe=f(["grid","x","type"],"tick"),Qb=f(["grid","x","lines"],null),Xc=f(["grid","y","show"],!1),Rb=f(["grid","y","lines"],null),Nb=f(["point","show"],!0)?f(["point","r"],2.5):0,ge=f(["point","focus","line","enabled"],!0),Sb=f(["point",
"focus","expand","enabled"],!0),Tb=f(["point","focus","expand","r"],Sb?4:Nb),Oa=f(["point","focus","select","r"],8),ne=f(["point","onclick"],function(){}),Vd=f(["point","onselected"],function(){}),Wd=f(["point","onunselected"],function(){}),Q=f(["regions"],[]),Jc=f(["tooltip","contents"],function(a){var b="<table class='-tooltip'><tr><th colspan='2'>"+bc()(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=r(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:"+L(a[c].id)+"'></span>"+f+"</td><td class='value'>"+d+"</td></tr>");return b+"</table>"}),ie=f(["tooltip","init","show"],!1),Ca=f(["tooltip","init","x"],0),Zc=f(["tooltip","init","position"],{top:"0px",left:"50px"}),Pb=wa.replace("#","")+"-clip",Pa="url(#"+Pb+")",B="timeseries"===id,ea="categorized"===id,Fb=!B&&(qa||Z),Vb=null,Qa=!1,Ub=!1,na=Ba?40:0,L=function(a,b){var c=[],d=null!==b?b:"#1f77b4 #ff7f0e #2ca02c #d62728 #9467bd #8c564b #e377c2 #7f7f7f #bcbd22 #17becf".split(" ");
"focus","expand","enabled"],!0),Tb=f(["point","focus","expand","r"],Sb?4:Nb),Oa=f(["point","focus","select","r"],8),ne=f(["point","onclick"],function(){}),Vd=f(["point","onselected"],function(){}),Wd=f(["point","onunselected"],function(){}),Q=f(["regions"],[]),Jc=f(["tooltip","contents"],function(a){var b="<table class='-tooltip'><tr><th colspan='2'>"+bc()(a[0].x)+"</th></tr>",c,e,d;for(c=0;c<a.length;c++)a[c]&&(a[c].value||0===a[c].value)&&(e=r(a[c].value)?(Math.round(100*a[c].value)/100).toFixed(2):
"-",d=a[c].name,b+="<tr class='-tooltip-name-"+a[c].id+"'><td class='name'><span style='background-color:"+L(a[c].id)+"'></span>"+d+"</td><td class='value'>"+e+"</td></tr>");return b+"</table>"}),ie=f(["tooltip","init","show"],!1),Ca=f(["tooltip","init","x"],0),Zc=f(["tooltip","init","position"],{top:"0px",left:"50px"}),Pb=wa.replace("#","")+"-clip",Pa="url(#"+Pb+")",B="timeseries"===id,ea="categorized"===id,Fb=!B&&(qa||Z),Vb=null,Qa=!1,Ub=!1,na=Ba?40:0,L=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]}}(ue,ve),qd=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)}}(),cc,gc,ec,ab,fc,hc,q,t,va,yb,ua,db,Ab,jb,mc,nc,Db,kc,lc,Bb,Cb,m,z,Y,U,gb,hb,J,oa,ib,fb,ld=l?"left":"bottom",md=l?cb?"top":"bottom":cb?"right":"left",nd=l?$a?"bottom":"top":$a?"left":"right",od="bottom",M={main:function(){return"translate("+I+","+u+")"},context:function(){return"translate("+n+","+Da+")"},legend:function(){return"translate("+
$b+","+Zb+")"},y2:function(){return"translate("+(l?0:q)+","+(l?10:0)+")"},x:function(){return"translate(0,"+t+")"},subx:function(){return"translate(0,"+va+")"},arc:function(){return"translate("+q/2+","+t/2+")"}};Db=d.layout.pie().value(function(a){return a.values.reduce(function(a,c){return a+c.value},0)});var pe=function(){var a=d.svg.line().x(l?function(a){return v(a.id)(a.value)}:xa).y(l?xa:function(a){return v(a.id)(a.value)});return function(b){var c=Kb(b.values),d;if(Hb(b))return Mc(b)?a.interpolate("cardinal"):

Loading…
Cancel
Save