Browse Source

Fix tooltip when null included

pull/34/merge
Masayuki Tanaka 11 years ago
parent
commit
39324817e0
  1. 2
      c3.js
  2. 2
      c3.min.js

2
c3.js

@ -902,7 +902,7 @@
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; }
if (selectedData.filter(function (d) { return d && d.value; }).length === 0) { return; }
// Construct tooltip
tooltip.html(__tooltip_contents(selectedData))
.style("visibility", "hidden")

2
c3.min.js vendored

@ -19,7 +19,7 @@ sc(a)});return b}function sc(a){return{id:a.id,id_org:a.id_org,values:a.values.m
a;return a.map(function(a){return a.id})}function zc(a){var b=rb(),c;for(c=0;c<b.length;c++)if(b[c]===a)return!0;return!1}function nb(a){return u(a)?h.data.targets.filter(a):h.data.targets}function qc(a){var b={};a.forEach(function(a){b[a.id]=[];a.values.forEach(function(e){b[a.id].push(e.value)})});return b}function Ac(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 rc(a){return Ac(a,function(a){return 0>a})}
function wd(a){return Ac(a,function(a){return 0<a})}function td(a){return a<Ha.length?Ha[a]:a}function Na(a){return"-shapes -shapes-"+a.id}function Bc(a){return Na(a)+" -line -line-"+a.id}function Md(a){return Na(a)+" -circles -circles-"+a.id}function Cc(a){return Na(a)+" -bars -bars-"+a.id}function Nd(a){return Na(a.data)+" -arc -arc-"+a.data.id}function Od(a){return Na(a)+" -area -area-"+a.id}function Pd(a,b){return"-shape -shape-"+b+" -circle -circle-"+b}function Dc(a,b){return"-shape -shape-"+
b+" -bar -bar-"+b}function Qd(a,b){return"region region-"+b+" "+("classes"in a?[].concat(a.classes).join(" "):"")}function Ec(a,b){return"event-rect event-rect-"+b}function Rd(a){return a.value?Fc(a)?0.5:1:0}function wa(a){return m(a.x)}function Oa(a){return m(B?na(a.value):a.value)}function Pa(a){return z(a.value)}function Gc(a){return V(a.x)}function Hc(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 Ic(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(Hc(a,c))),a[e].x&&(k=k.concat(Hc(a,e))),Jc(k,b)):Ic(a,b,c,e)}function Kc(a,b){var c;c=a.map(function(a){return Ic(a.values,b)});return Jc(c,b)}function Jc(a,b){var c,e;a.forEach(function(a){var d=Ob(a,b);if(d<c||!c)c=d,e=a});return e}function Lc(a,b){var c,e,k,d,f;0!==a.filter(function(a){return a.value}).length&&(W.html(Mc(a)).style("visibility","hidden").style("display","block"),
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(Hc(a,c))),a[e].x&&(k=k.concat(Hc(a,e))),Jc(k,b)):Ic(a,b,c,e)}function Kc(a,b){var c;c=a.map(function(a){return Ic(a.values,b)});return Jc(c,b)}function Jc(a,b){var c,e;a.forEach(function(a){var d=Ob(a,b);if(d<c||!c)c=d,e=a});return e}function Lc(a,b){var c,e,k,d,f;0!==a.filter(function(a){return a&&a.value}).length&&(W.html(Mc(a)).style("visibility","hidden").style("display","block"),
c=W.property("offsetWidth"),e=W.property("offsetHeight"),g?d=b[0]:(k=q.property("offsetLeft"),d=k+(ab?ab:bb?1:40)+m(a[0].x)+20,f=d+c,k=k+(null===$a?ca():$a)-(cb?cb:Bb?db||g?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 Nc(a){ma(h.data.targets,"scatter")||D(h.data.targets)||l.selectAll("line.xgrid-focus").style("visibility","visible").data([a]).attr(g?"y1":"x1",wa).attr(g?"y2":"x2",wa)}function Oc(){l.select("line.xgrid-focus").style("visibility",
"hidden")}function xa(a){return a.x||0===a.x?m(a.x):null}function ya(a){return w(a.id)(a.value)}function Sd(){var a={},b=0,c,e;nb(sb).forEach(function(k){for(c=0;c<t.length;c++)if(!(0>t[c].indexOf(k.id)))for(e=0;e<t[c].length;e++)if(t[c][e]in a){a[k.id]=a[t[c][e]];break}x(a[k.id])&&(a[k.id]=b++)});a.__max__=b-1;return a}function Td(a,b,c,e){var k=e?V: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 Ud(a){return function(b){return(a?
G(b.id):w(b.id))(b.value)}}function Vd(a,b){var c=Object.keys(a);return function(e,k){var d=b?G(e.id):w(e.id),f=d(0),g=f;nb(sb).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 Ma(a,b){var c=x(a)?rb():a;"string"===typeof c&&(c=[c]);for(var e=0;e<c.length;e++)C[c[e]]=b}function ma(a,b){var c=!1;a.forEach(function(a){C[a.id]===b&&(c=!0);a.id in C||"line"!==b||(c=!0)});return c}function D(a){return ma(a,

Loading…
Cancel
Save