Browse Source

Fix x grid focus

pull/18/head 0.1.5
Masayuki Tanaka 11 years ago
parent
commit
8591af9d87
  1. 8
      c3.js
  2. 2
      c3.min.js

8
c3.js

@ -721,8 +721,8 @@
}
function showXGridFocus(data) {
// Show when line chart exists
if (! hasLineType(c3.data.targets)) { return; }
// Hide when scatter plot exists
if (hasScatterType(c3.data.targets)) { return; }
main.selectAll('line.xgrid-focus')
.style("visibility", "visible")
.data([data])
@ -817,17 +817,17 @@
});
return has;
}
/* not used
function hasLineType(targets) {
return hasType(targets, 'line');
}
*/
function hasBarType(targets) {
return hasType(targets, 'bar');
}
/* not used
function hasScatterType(targets) {
return hasType(targets, 'scatter');
}
*/
function isLineType(d) {
var id = (typeof d === 'string') ? d : d.id;
return !(id in __data_types) || __data_types[id] === 'line' || __data_types[id] === 'spline';

2
c3.min.js vendored

@ -15,7 +15,7 @@ null:+a[b],id:d}})}});b.forEach(function(a){var b;a.values=a.values.sort(functio
function vb(a){var b=gb(),d;for(d=0;d<b.length;d++)if(b[d]===a)return!0;return!1}function db(a){return n(a)?h.data.targets.filter(a):h.data.targets}function bd(a){return a<Ga.length?Ga[a]:a}function wb(a){return"-shapes -shapes-"+a.id}function ic(a){return wb(a)+" -line -line-"+a.id}function ld(a){return wb(a)+" -circles -circles-"+a.id}function jc(a){return wb(a)+" -bars -bars-"+a.id}function md(a,b){return"-shape -shape-"+b+" -circle -circle-"+b}function kc(a,b){return"-shape -shape-"+b+" -bar -bar-"+
b}function nd(a,b){return"region region-"+b+" "+("classes"in a?[].concat(a.classes).join(" "):"")}function hb(a){return m(a.x)}function Na(a){return m(C?pa(a.value):a.value)}function lc(a){return v(a.value)}function mc(a,b){var d,f=a[b].x,c=[];for(d=b-1;0<=d&&f===a[d].x;d--)c.push(a[d]);for(d=b;d<a.length&&f===a[d].x;d++)c.push(a[d]);return c}function nc(a,b,d,f){d=d?d:0;f=f?f:a.length-1;var c=Math.floor((f-d)/2)+d;0<m(a[c].x)-b[0]?f=c:d=c;return 1===f-d?(c=[],a[d].x&&(c=c.concat(mc(a,d))),a[f].x&&
(c=c.concat(mc(a,f))),oc(c,b)):nc(a,b,d,f)}function pc(a,b){var d;d=a.map(function(a){return nc(a.values,b)});return oc(d,b)}function oc(a,b){var d,f;a.forEach(function(a){var c=xb(a,b);if(c<d||!d)d=c,f=a});return f}function qc(a,b){O.html(rc(a)).style("visibility","hidden").style("display","block");var d=O.property("offsetWidth"),f=O.property("offsetHeight");O.style("top",(b[1]+15+f<U()?b[1]+15:b[1]-f)+"px").style("left",g?b[0]:m(a[0].x)+60+d<(null===Ya?ba():Ya)?m(a[0].x)+60+"px":m(a[0].x)-d+30+
"px").style("visibility","visible")}function sc(a){cc(h.data.targets,"line")&&k.selectAll("line.xgrid-focus").style("visibility","visible").data([a]).attr(g?"y1":"x1",hb).attr(g?"y2":"x2",hb)}function tc(){k.select("line.xgrid-focus").style("visibility","hidden")}function fa(a){return a.x||0===a.x?m(a.x):null}function ga(a){return F(a.id)(a.value)}function od(){var a={},b=0,d,f;db(Ha).forEach(function(c){for(d=0;d<u.length;d++)if(!(0>u[d].indexOf(c.id)))for(f=0;f<u[d].length;f++)if(u[d][f]in a){a[c.id]=
"px").style("visibility","visible")}function sc(a){cc(h.data.targets,"scatter")||k.selectAll("line.xgrid-focus").style("visibility","visible").data([a]).attr(g?"y1":"x1",hb).attr(g?"y2":"x2",hb)}function tc(){k.select("line.xgrid-focus").style("visibility","hidden")}function fa(a){return a.x||0===a.x?m(a.x):null}function ga(a){return F(a.id)(a.value)}function od(){var a={},b=0,d,f;db(Ha).forEach(function(c){for(d=0;d<u.length;d++)if(!(0>u[d].indexOf(c.id)))for(f=0;f<u[d].length;f++)if(u[d][f]in a){a[c.id]=
a[u[d][f]];break}s(a[c.id])&&(a[c.id]=b++)});a.__max__=b-1;return a}function uc(a,b,d,f){var c=f?ea:m;return b?function(f){var e=f.id in d?d[f.id]:0;return f.x||0===f.x?c(f.x)-a*(b/2-e):0}:function(){return 0}}function vc(a,b,d,f){var c=Object.keys(b);return function(e,g){var h=0,k=f?T(e.id):F(e.id);db(Ha).forEach(function(d){d.id!==e.id&&b[d.id]===b[e.id]&&c.indexOf(d.id)<c.indexOf(e.id)&&(h+=a(d.values[g]))});return d?h:k(e.value)-h}}function wc(a,b){var d=null===a?function(a){return a}:function(b){return a>
b?a-b:0};return function(a){var c=b?T(a.id):F(a.id);return d(c(a.value))}}function Oa(a,b){var d=s(a)?gb():a;"string"===typeof d&&(d=[d]);for(var f=0;f<d.length;f++)P[d[f]]=b}function cc(a,b){var d=!1;a.forEach(function(a){P[a.id]===b&&(d=!0);a.id in P||"line"!==b||(d=!0)});return d}function yb(a){a="string"===typeof a?a:a.id;return!(a in P)||"line"===P[a]||"spline"===P[a]}function Ha(a){return"bar"===P["string"===typeof a?a:a.id]}function xc(a){return Ha(a)?a.values:[]}function pd(a){var b;(b=yb(a))||
(b="scatter"===P["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 "+zb+". Maybe 'x' of this data is not defined. See data.x or data.xs option.");b=c.time.format(zb).parse(a);if(!b)throw Error("Failed to parse '"+a+"' with format "+zb);return b}function yc(a,b){var d=c.mouse(a),f=c.select(a),e=1*f.attr("cx"),f=1*f.attr("cy");return Math.sqrt(Math.pow(e-d[0],2)+Math.pow(f-d[1],2))<b}function zc(a){var b=c.mouse(a),

Loading…
Cancel
Save