diff --git a/c3.js b/c3.js index d060110..231d7ce 100644 --- a/c3.js +++ b/c3.js @@ -875,6 +875,8 @@ function showTooltip(selectedData, mouse) { var tWidth, tHeight; var svgLeft, tooltipLeft, tooltipRight, tooltipTop, chartRight; + // don't show tooltip when no data + if (selectedData.filter(function (d) { return d.value; }).length === 0) { return; } // Construct tooltip tooltip.html(__tooltip_contents(selectedData)) .style("visibility", "hidden") diff --git a/c3.min.js b/c3.min.js index 57cedc0..7401f5f 100644 --- a/c3.min.js +++ b/c3.min.js @@ -19,16 +19,16 @@ values:a.values.map(function(a){return{x:a.x,value:a.value,id:a.id}})}}function rb(),c;for(c=0;ca})}function vd(a){return zc(a,function(a){return 0k&&(d-=c+30));c=b[1]+15+et[c].indexOf(k.id)))for(e=0;e=f;f+=s)g+=e(a[d-1],a[d],f,ya)}return g}function Pb(a){var b;tb=d.select(ua);if(tb.empty())P.alert('No bind element found. Check the selector specified by "bindto" and existance of that element. Default "bindto" is "#chart".'); +(k=k.concat(Fc(a,c))),a[e].x&&(k=k.concat(Fc(a,e))),Hc(k,b)):Gc(a,b,c,e)}function Ic(a,b){var c;c=a.map(function(a){return Gc(a.values,b)});return Hc(c,b)}function Hc(a,b){var c,e;a.forEach(function(a){var d=Hb(a,b);if(dk&&(d-=c+30)),c=b[1]+15+et[c].indexOf(k.id)))for(e=0;e=f;f+=s)g+=e(a[d-1],a[d],f,ya)}return g}function Pb(a){var b;tb=d.select(ua);if(tb.empty())P.alert('No bind element found. Check the selector specified by "bindto" and existance of that element. Default "bindto" is "#chart".'); else{tb.html("");g.data.x={};g.data.targets=Ka(a);ra();R();m.domain(d.extent(ob(g.data.targets)));z.domain(mb("y"));Y.domain(mb("y2"));U.domain(m.domain());hb.domain(z.domain());ib.domain(Y.domain());J.ticks(10>a.length?a.length:10);ma.ticks(ae).outerTickSize(0).tickFormat(be);jb.ticks(ce).outerTickSize(0).tickFormat(de);V=m.domain();K.x(U);pa&&F.x(m);n=d.select(ua).append("svg").attr("width",q+I+da).attr("height",s+u+O).on("mouseenter",ee).on("mouseleave",fe);ub=n.append("defs");ub.append("clipPath").attr("id", Qb).append("rect").attr("y",u).attr("width",q).attr("height",s-u);ub.append("clipPath").attr("id","xaxis-clip").append("rect").attr("x",-1-I).attr("y",-20).attr("width",N).attr("height",ca);ub.append("clipPath").attr("id","yaxis-clip").append("rect").attr("x",-I+1).attr("y",u-1).attr("width",ia).attr("height",yb);l=n.append("g").attr("transform",M.main);A=za?n.append("g").attr("transform",M.context):null;Aa=Ba?n.append("g").attr("transform",M.legend):null;W=d.select(ua).style("position","relative").append("div").style("position", "absolute").style("z-index","10").style("display","none");l.append("g").attr("class","x axis").attr("clip-path",h?"":"url(#xaxis-clip)").attr("transform",M.x).call(h?ma:J).append("text").attr("class","-axis-x-label").attr("x",q).attr("dy","-.5em").style("text-anchor","end").text(ge);l.append("g").attr("class","y axis").attr("clip-path",h?"url(#yaxis-clip)":"").call(h?J:ma).append("text").attr("transform","rotate(-90)").attr("dy","1.2em").attr("dx","-.5em").style("text-anchor","end").text(he);Ab&&