Browse Source

Fix padding.right

pull/34/merge
Masayuki Tanaka 11 years ago
parent
commit
3cc91336a1
  1. 2
      c3.js
  2. 4
      c3.min.js

2
c3.js

@ -271,7 +271,7 @@
} else if (__axis_y2_show) {
return __axis_y2_inner || __axis_rotated ? 1 : getDefaultPaddingWithAxisId('y2');
} else {
return 20;
return 1;
}
}
function getDefaultPaddingWithAxisId() {

4
c3.min.js vendored

@ -3,7 +3,7 @@ X=p.selectAll(".tick.major").data(na,String),Y=X.enter().insert("g","path").attr
$a=Y.select("text"),Ia=ha.select("text");fa=(B(1)-B(0))/2;X=ua?0:fa;switch(C){case "bottom":I=q;R.attr("y2",M);$a.attr("y",Math.max(M,0)+g);Q.attr("x1",X).attr("x2",X).attr("y2",M);Ia.attr("x",0).attr("y",Math.max(M,0)+g);Z.attr("dy",".71em").style("text-anchor","middle");Z.text(function(e){return na.length<S||0===e%Math.ceil(na.length/S)?Ha(e):""});p.attr("d","M"+v[0]+","+$+"V0H"+v[1]+"V"+$);break;case "left":I=y,R.attr("x2",-M),$a.attr("x",-(Math.max(M,0)+g)),Q.attr("x2",-M).attr("y2",0),Ia.attr("x",
-(Math.max(M,0)+g)).attr("y",fa),Z.attr("dy",".32em").style("text-anchor","end"),Z.text(function(e){return na.length<S||0===e%Math.ceil(na.length/S)?Ha(e):""}),p.attr("d","M"+-$+","+v[0]+"H0V"+v[1]+"H"+-$)}if(t.ticks)Y.call(I,W),ha.call(I,B),ga.call(I,B);else{var yb=B.rangeBand()/2,ga=function(e){return B(e)+yb};Y.call(I,ga);ha.call(I,ga)}})}var t=e.scale.linear(),C="bottom",M=6,$=6,g=3,ua=!1,S=10,fa=0,Q=null,W=[];p.scale=function(e){if(!arguments.length)return t;t=e;return p};p.orient=function(e){if(!arguments.length)return C;
C=e in{top:1,right:1,bottom:1,left:1}?e+"":"bottom";return p};p.categories=function(e){if(!arguments.length)return W;W=e;return p};p.tickCentered=function(e){if(!arguments.length)return ua;ua=e;return p};p.tickTextNum=function(e){if(!arguments.length)return S;S=e;return p};p.tickFormat=function(e){if(!arguments.length)return Q;Q=e;return p};p.tickOffset=function(){return fa};p.ticks=function(){};return p}function y(e){return"undefined"===typeof e}function q(e){return"undefined"!==typeof e}var zb=
O.c3={},e=O.d3;zb.generate=function(ea){var mc,nc,Ga,Ha,p,t,C,M,$;function g(a,b){for(var c=ea,d=0;d<a.length;d++){if(!(a[d]in c))return b;c=c[a[d]]}return c}function ua(){Ab=null===ab?Q():ab;va=fa();t=0;C=(h?Bb+qc:0)+(bb?bb:cb?1:40);M=20+(h?0:Bb)+oa;$=db?db:Cb?eb||h?1:40:20;r=Ab-C-$;s=va-t-M;Ga=h?t:va-Bb-oa;Ha=h?rc:C;p=20+oa;Db=h?C-rc-qc:r;fb=h?s:va-Ga-p;mc=va-oa;nc=C;S()}function S(){Eb=s/2;Ja=0.95*Eb;Fb=ia(k.data.targets,"donut")?0.6*Ja:0}function fa(){var a=null===sc?+e.select(wa).style("height").replace("px",
O.c3={},e=O.d3;zb.generate=function(ea){var mc,nc,Ga,Ha,p,t,C,M,$;function g(a,b){for(var c=ea,d=0;d<a.length;d++){if(!(a[d]in c))return b;c=c[a[d]]}return c}function ua(){Ab=null===ab?Q():ab;va=fa();t=0;C=(h?Bb+qc:0)+(bb?bb:cb?1:40);M=20+(h?0:Bb)+oa;$=db?db:Cb?eb||h?1:40:1;r=Ab-C-$;s=va-t-M;Ga=h?t:va-Bb-oa;Ha=h?rc:C;p=20+oa;Db=h?C-rc-qc:r;fb=h?s:va-Ga-p;mc=va-oa;nc=C;S()}function S(){Eb=s/2;Ja=0.95*Eb;Fb=ia(k.data.targets,"donut")?0.6*Ja:0}function fa(){var a=null===sc?+e.select(wa).style("height").replace("px",
""):sc;return 0<a?a:320}function Q(){return+e.select(wa).style("width").replace("px","")}function W(){return r+2+C+$}function na(){return 40}function zb(){return C+20}function ud(){return s-t+2}function X(){var a=h?s:r,b=xa(T)/xa(m.domain()),c=gb();return 1<c?a*b/(c-1):a}function Y(){Gb=h?1:0;Hb=h?s:r;Ib=h?0:s;Jb=h?r:1;Kb=h?0:fb;Lb=h?Db:1;m=ha(Gb,Hb,q(m)?m.domain():void 0,function(){return J.tickOffset()});z=I(Ib,Jb,q(z)?z.domain():void 0);aa=I(Ib,Jb,q(aa)?aa.domain():void 0);U=ha(Gb,Hb,q(T)?T:void 0,
function(a){return 0===a%1?hb.tickOffset():0});ib=I(Kb,Lb);jb=I(Kb,Lb);J=oc(m,wd);ya=e.svg.axis().scale(z).orient(xd);kb=e.svg.axis().scale(aa).orient(yd);hb=oc(U,zd);ga()}function ga(){lb=$a();tc=Ia();uc=Ia(0.98)}function ha(a,b,c,d){var f=(D?e.time.scale():e.scale.linear()).range([a,b]);f.orgDomain=function(){return f.domain()};q(c)&&f.domain(c);y(d)&&(d=function(){return 0});if(ja){var H=f,u,f=function(a){return H(a)+d(a)};for(u in H)f[u]=H[u];f.orgDomain=function(){return H.domain()};f.domain=
function(a){if(!arguments.length)return a=H.domain(),[a[0],a[1]+1];H.domain(a);return f}}return f}function I(a,b){return e.scale.linear().range([a,b])}function v(a){return"y2"===R(a)?aa:z}function B(a){return"y2"===R(a)?jb:ib}function oc(a,b){var c=(ja?td():e.svg.axis()).scale(a).orient(b);c.tickFormat(pc());ja?c.categories(Ka).tickCentered(Ad):c.tickOffset=function(){return 0};return c}function R(a){return a in vc?vc[a]:"y"}function pc(){var a=D?Bd:ja?Cd:function(a){return a};mb&&(a="function"===
@ -20,7 +20,7 @@ b&&(c=a,b=a.values.length)}):c=a?k.data.targets[0]:null;return c}function Pa(a){
0;f<e.length;f++)if(b(e[f].value))return!0;return!1}function yc(a){return Hc(a,function(a){return 0>a})}function Gd(a){return Hc(a,function(a){return 0<a})}function Cd(a){return a<Ka.length?Ka[a]:a}function Qa(a){return"-shapes -shapes-"+a.id}function Ic(a){return Qa(a)+" -line -line-"+a.id}function Wd(a){return Qa(a)+" -circles -circles-"+a.id}function Jc(a){return Qa(a)+" -bars -bars-"+a.id}function Xd(a){return Qa(a.data)+" -arc -arc-"+a.data.id}function Yd(a){return Qa(a)+" -area -area-"+a.id}
function Zd(a,b){return"-shape -shape-"+b+" -circle -circle-"+b}function Kc(a,b){return"-shape -shape-"+b+" -bar -bar-"+b}function $d(a,b){return"region region-"+b+" "+("classes"in a?[].concat(a.classes).join(" "):"")}function Lc(a,b){return"event-rect event-rect-"+b}function ae(a){return a.value?Mc(a)?0.5:1:0}function za(a){return m(a.x)}function Ra(a){return m(D?pa(a.value):a.value)}function Sa(a){return z(a.value)}function Nc(a){return U(a.x)}function Oc(a,b){var c,d=a[b].x,f=[];for(c=b-1;0<=c&&
d===a[c].x;c--)f.push(a[c]);for(c=b;c<a.length&&d===a[c].x;c++)f.push(a[c]);return f}function Pc(a,b,c,d){c=c?c:0;d=d?d:a.length-1;var f=Math.floor((d-c)/2)+c;0<m(a[f].x)-b[0]?d=f:c=f;return 1===d-c?(f=[],a[c].x&&(f=f.concat(Oc(a,c))),a[d].x&&(f=f.concat(Oc(a,d))),Qc(f,b)):Pc(a,b,c,d)}function Rc(a,b){var c;c=a.map(function(a){return Pc(a.values,b)});return Qc(c,b)}function Qc(a,b){var c,d;a.forEach(function(a){var e=Rb(a,b);if(e<c||!c)c=e,d=a});return d}function Sc(a,b){var c,d,f,e,g;Tc&&0!==a.filter(function(a){return a&&
a.value}).length&&(V.html(Uc(a)).style("visibility","hidden").style("display","block"),c=V.property("offsetWidth"),d=V.property("offsetHeight"),h?e=b[0]:(f=n.property("offsetLeft"),e=f+(bb?bb:cb?1:40)+m(a[0].x)+20,g=e+c,f=f+(null===ab?Q():ab)-(db?db:Cb?eb||h?1:40:20),g>f&&(e-=c+30)),c=b[1]+15+d<fa()?b[1]+15:b[1]-d,V.style("top",c+"px").style("left",e+"px").style("visibility","visible"))}function Vc(a){Tc&&(ia(k.data.targets,"scatter")||E(k.data.targets)||l.selectAll("line.xgrid-focus").style("visibility",
a.value}).length&&(V.html(Uc(a)).style("visibility","hidden").style("display","block"),c=V.property("offsetWidth"),d=V.property("offsetHeight"),h?e=b[0]:(f=n.property("offsetLeft"),e=f+(bb?bb:cb?1:40)+m(a[0].x)+20,g=e+c,f=f+(null===ab?Q():ab)-(db?db:Cb?eb||h?1:40:1),g>f&&(e-=c+30)),c=b[1]+15+d<fa()?b[1]+15:b[1]-d,V.style("top",c+"px").style("left",e+"px").style("visibility","visible"))}function Vc(a){Tc&&(ia(k.data.targets,"scatter")||E(k.data.targets)||l.selectAll("line.xgrid-focus").style("visibility",
"visible").data([a]).attr(h?"y1":"x1",za).attr(h?"y2":"x2",za))}function Wc(){l.select("line.xgrid-focus").style("visibility","hidden")}function Aa(a){return a.x||0===a.x?m(a.x):null}function Ba(a){return v(a.id)(a.value)}function be(){var a={},b=0,c,d;ob(sb).forEach(function(f){for(c=0;c<w.length;c++)if(!(0>w[c].indexOf(f.id)))for(d=0;d<w[c].length;d++)if(w[c][d]in a){a[f.id]=a[w[c][d]];break}y(a[f.id])&&(a[f.id]=b++)});a.__max__=b-1;return a}function ce(a,b,c,d){var f=d?U:m;return b?function(d){var e=
d.id in c?c[d.id]:0;return d.x||0===d.x?f(d.x)-a*(b/2-e):0}:function(){return 0}}function de(a){return function(b){return(a?B(b.id):v(b.id))(b.value)}}function ee(a,b){var c=Object.keys(a);return function(d,f){var e=b?B(d.id):v(d.id),g=e(0),h=g;ob(sb).forEach(function(b){b.id!==d.id&&a[b.id]===a[d.id]&&c.indexOf(b.id)<c.indexOf(d.id)&&0<b.values[f].value*d.value&&(h+=e(b.values[f].value)-g)});return h}}function ca(a,b){var c=y(a)?Pa():a;"string"===typeof c&&(c=[c]);for(var d=0;d<c.length;d++)Sb[c[d]]=
b===A[c[d]],A[c[d]]=b}function ia(a,b){var c=!1;a.forEach(function(a){A[a.id]===b&&(c=!0);a.id in A||"line"!==b||(c=!0)});return c}function Ta(a){return Sb[a.id]?1:0}function E(a){return ia(a,"pie")||ia(a,"donut")}function Tb(a){a="string"===typeof a?a:a.id;return!(a in A)||"line"===A[a]||"spline"===A[a]||"area"===A[a]||"area-spline"===A[a]}function Xc(a){a="string"===typeof a?a:a.id;return"spline"===A[a]||"area-spline"===A[a]}function sb(a){return"bar"===A["string"===typeof a?a:a.id]}function Mc(a){return"scatter"===

Loading…
Cancel
Save