diff --git a/c3.js b/c3.js index 8523c21..93e316d 100644 --- a/c3.js +++ b/c3.js @@ -1453,11 +1453,12 @@ return points[0][0] + (points[2][0] - points[0][0]) / 2; } } - function getYForText(points, d, that) { + function getYForText(points, d, textElement) { + var box = textElement.getBBox(); if (__axis_rotated) { - return (points[0][0] + points[2][0] + that.offsetHeight * 0.6) / 2; + return (points[0][0] + points[2][0] + box.height * 0.6) / 2; } else { - return points[2][1] + (d.value < 0 ? that.offsetHeight : isBarType(d) ? -3 : -6); + return points[2][1] + (d.value < 0 ? box.height : isBarType(d) ? -3 : -6); } } diff --git a/c3.min.js b/c3.min.js index 93fe26d..31a1743 100644 --- a/c3.min.js +++ b/c3.min.js @@ -30,7 +30,7 @@ a:a.id]}function gd(a){return"pie"===z["string"===typeof a?a:a.id]}function Tb(a $b);return b}function id(a,b){var c=e.mouse(a),g=e.select(a),k=1*g.attr("cx"),g=1*g.attr("cy");return Math.sqrt(Math.pow(k-c[0],2)+Math.pow(g-c[1],2))b.value?-1:1)):a[0][0]+(a[2][0]-a[0][0])/2}function Ge(a,b,c){return h?(a[0][0]+a[2][0]+0.6*c.offsetHeight)/2:a[2][1]+(0>b.value?c.offsetHeight:va(b)?-3:-6)}function pd(a,b){var c=a.__max__+1,g=c?1.2*S.tickOffset()/c:0,d=we(g,c,a,!!b),e=xe(!!b),f=ye(a,!!b),h=b?H:t;return function(a,b){var c=h(a.id)(0), +" L"+d[2][e]+","+d[2][f]+" L"+d[3][e]+","+d[3][f]+" z"}}function qd(a,b){var c=pd(a,!1),g=b?Fe:Ge;return function(a,b){return g(c(a,b),a,this)}}function Fe(a,b){var c;return h?(c=va(b)?4:6,a[2][1]+c*(0>b.value?-1:1)):a[0][0]+(a[2][0]-a[0][0])/2}function Ge(a,b,c){c=c.getBBox();return h?(a[0][0]+a[2][0]+0.6*c.height)/2:a[2][1]+(0>b.value?c.height:va(b)?-3:-6)}function pd(a,b){var c=a.__max__+1,g=c?1.2*S.tickOffset()/c:0,d=we(g,c,a,!!b),e=xe(!!b),f=ye(a,!!b),h=b?H:t;return function(a,b){var c=h(a.id)(0), l=f(a,b)||c;return[[d(a),l],[d(a),e(a)-(c-l)],[d(a)+g,e(a)-(c-l)],[d(a)+g,l]]}}function He(a,b,c,g){var d,e,f="M",l,n,m,p,q,s=[];if(y(g))for(d=0;d=e;e+=r)f+=g(a[d-1],a[d],e,m)}return f}function fc(a){var b;ub=e.select(ya);if(ub.empty())N.alert('No bind element found. Check the selector specified by "bindto" and existance of that element. Default "bindto" is "#chart".'); else{ub.html("");f.data.x={};f.data.targets=Wa(a);qa();P();m.domain(e.extent(qb(f.data.targets)));D.domain(ob("y"));aa.domain(ob("y2"));T.domain(m.domain());kb.domain(D.domain());lb.domain(aa.domain());$=m.domain();J.scale(T);ea&&E.scale(m);p=e.select(ya).append("svg").attr("width",q+v+M).attr("height",r+n+pa).on("mouseenter",Ie).on("mouseleave",Je);vb=p.append("defs");vb.append("clipPath").attr("id",gc).append("rect").attr("width",q).attr("height",r);vb.append("clipPath").attr("id","xaxis-clip").append("rect").attr("x",