From a9c033970098347cc19f0f24d78245a22e97ee29 Mon Sep 17 00:00:00 2001 From: Masayuki Tanaka Date: Thu, 9 Jan 2014 08:53:32 +0900 Subject: [PATCH] Fix jshint --- c3.js | 16 +++++------ c3.min.js | 84 +++++++++++++++++++++++++++---------------------------- 2 files changed, 50 insertions(+), 50 deletions(-) diff --git a/c3.js b/c3.js index 606dcb3..e5b2567 100644 --- a/c3.js +++ b/c3.js @@ -450,7 +450,7 @@ // check __data_x is defined if timeseries if (isTimeSeries && ! __data_x) { - alert('data.x must be specified when axis.x.type == "timeseries"'); + window.alert('data.x must be specified when axis.x.type == "timeseries"'); return []; } @@ -499,10 +499,10 @@ }; } function getPrevX(i) { - return i > 0 ? c3.data.targets[0].values[i-1].x : undefined; + return i > 0 ? c3.data.targets[0].values[i - 1].x : undefined; } function getNextX(i) { - return i < maxDataCount() - 1 ? c3.data.targets[0].values[i+1].x : undefined; + return i < maxDataCount() - 1 ? c3.data.targets[0].values[i + 1].x : undefined; } function maxDataCount() { return d3.max(c3.data.targets, function (t) { return t.values.length; }); @@ -1495,17 +1495,17 @@ // rect for mouseover if (isCustomX) { - rectW = function (d,i) { + rectW = function (d, i) { var prevX = getPrevX(i), nextX = getNextX(i); - return (x(nextX ? nextX : d.x+50)-x(prevX ? prevX : d.x-50))/2; + return (x(nextX ? nextX : d.x + 50) - x(prevX ? prevX : d.x - 50)) / 2; }; - rectX = function (d,i) { + rectX = function (d, i) { var prevX = getPrevX(i); - return (x(d.x)+x(prevX ? prevX : d.x-50))/2; + return (x(d.x) + x(prevX ? prevX : d.x - 50)) / 2; }; } else { rectW = (((__axis_rotated ? height : width) * getXDomainRatio()) / (maxDataCount() - 1)); - rectX = function (d,i) { return x(d.x) - (rectW / 2); }; + rectX = function (d) { return x(d.x) - (rectW / 2); }; } main.selectAll('.event-rect') .attr("x", __axis_rotated ? 0 : rectX) diff --git a/c3.min.js b/c3.min.js index 5adbf51..6f9a78b 100644 --- a/c3.min.js +++ b/c3.min.js @@ -1,66 +1,66 @@ -(function(qa){function sc(){function n(e,c){e.attr("transform",function(e){return"translate("+(c(e)+U)+", 0)"})}function s(e,c){e.attr("transform",function(e){return"translate(0,"+c(e)+")"})}function qa(e){var c=e[0];e=e[e.length-1];return ca?0:a}function ga(a){var b=La[a.id];a.name=n(b)?b:a.id;return a}function Ea(a){var b=a[0],d={},h=[],e,c;for(e=1;ea?0:a}function ha(a){var b=La[a.id];a.name=n(b)?b:a.id;return a}function Ea(a){var b=a[0],d={},h=[],e,c;for(e=1;ev[d].indexOf(e.id)))for(h=0;hv[d].indexOf(e.id)))for(h=0;h=g;g+=t)r+=e(a[c-1],a[c],g,u)}return r} -function tb(a){var b=k.data.targets=ha(a),d,c;hc=e.select(ua);if(hc.empty())qa.alert('No bind element found. Check the selector specified by "bindto" and existance of that element. Default "bindto" is "#chart".');else{P();U();l.domain(e.extent(a.map(function(a){return a.x})));z.domain(D(b,"y"));Q.domain(D(b,"y2"));X.domain(l.domain());Wa.domain(z.domain());Xa.domain(Q.domain());J.ticks(10>a.length?a.length:10);ka.ticks(Qc).outerTickSize(0).tickFormat(Rc);Ya.ticks(Sc).outerTickSize(0).tickFormat(Tc); -R=l.domain();F.x(X);na&&G.x(l);Oa=e.select(ua).append("svg").attr("width",q+I+E).attr("height",t+w+W).on("mouseenter",Uc).on("mouseleave",Vc);cb=Oa.append("defs");cb.append("clipPath").attr("id",ub).append("rect").attr("y",w).attr("width",q).attr("height",t-w);cb.append("clipPath").attr("id","xaxis-clip").append("rect").attr("x",-1).attr("y",-1).attr("width",q+2).attr("height",40);cb.append("clipPath").attr("id","yaxis-clip").append("rect").attr("x",-I+1).attr("y",w-1).attr("width",I).attr("height", -t-w+2);g=Oa.append("g").attr("transform",K.main);y=ya?Oa.append("g").attr("transform",K.context):null;za=Aa?Oa.append("g").attr("transform",K.legend):null;ba=e.select(ua).style("position","relative").append("div").style("position","absolute").style("width","30%").style("z-index","10").style("visibility","hidden");g.append("g").attr("class","x axis").attr("clip-path",f?"":"url(#xaxis-clip)").attr("transform",K.x).call(f?ka:J);g.append("g").attr("class","y axis").attr("clip-path",f?"url(#yaxis-clip)": -"").call(f?J:ka).append("text").attr("transform","rotate(-90)").attr("dy","1.4em").attr("dx","-.8em").style("text-anchor","end").text(Wc);Jb&&g.append("g").attr("class","y2 axis").attr("transform",K.y2).call(Ya);d=g.append("g").attr("clip-path",Pa).attr("class","grid");ic&&d.append("g").attr("class","xgrids");vb&&(c=d.append("g").attr("class","xgrid-lines").selectAll(".xgrid-line").data(vb).enter().append("g").attr("class","xgrid-line"),c.append("line").attr("class",function(a){return""+a["class"]}), +function tb(a){var b=k.data.targets=ia(a),d,c;hc=e.select(ua);if(hc.empty())fa.alert('No bind element found. Check the selector specified by "bindto" and existance of that element. Default "bindto" is "#chart".');else{P();U();l.domain(e.extent(a.map(function(a){return a.x})));z.domain(D(b,"y"));Q.domain(D(b,"y2"));X.domain(l.domain());Wa.domain(z.domain());Xa.domain(Q.domain());J.ticks(10>a.length?a.length:10);la.ticks(Qc).outerTickSize(0).tickFormat(Rc);Ya.ticks(Sc).outerTickSize(0).tickFormat(Tc); +R=l.domain();F.x(X);oa&&G.x(l);Oa=e.select(ua).append("svg").attr("width",q+I+E).attr("height",t+w+W).on("mouseenter",Uc).on("mouseleave",Vc);cb=Oa.append("defs");cb.append("clipPath").attr("id",ub).append("rect").attr("y",w).attr("width",q).attr("height",t-w);cb.append("clipPath").attr("id","xaxis-clip").append("rect").attr("x",-1).attr("y",-1).attr("width",q+2).attr("height",40);cb.append("clipPath").attr("id","yaxis-clip").append("rect").attr("x",-I+1).attr("y",w-1).attr("width",I).attr("height", +t-w+2);g=Oa.append("g").attr("transform",K.main);y=ya?Oa.append("g").attr("transform",K.context):null;za=Aa?Oa.append("g").attr("transform",K.legend):null;ba=e.select(ua).style("position","relative").append("div").style("position","absolute").style("width","30%").style("z-index","10").style("visibility","hidden");g.append("g").attr("class","x axis").attr("clip-path",f?"":"url(#xaxis-clip)").attr("transform",K.x).call(f?la:J);g.append("g").attr("class","y axis").attr("clip-path",f?"url(#yaxis-clip)": +"").call(f?J:la).append("text").attr("transform","rotate(-90)").attr("dy","1.4em").attr("dx","-.8em").style("text-anchor","end").text(Wc);Jb&&g.append("g").attr("class","y2 axis").attr("transform",K.y2).call(Ya);d=g.append("g").attr("clip-path",Pa).attr("class","grid");ic&&d.append("g").attr("class","xgrids");vb&&(c=d.append("g").attr("class","xgrid-lines").selectAll(".xgrid-line").data(vb).enter().append("g").attr("class","xgrid-line"),c.append("line").attr("class",function(a){return""+a["class"]}), c.append("text").attr("class",function(a){return""+a["class"]}).attr("text-anchor","end").attr("transform",f?"":"rotate(-90)").attr("dx",f?0:-w).attr("dy",-6).text(function(a){return a.text}));Xc&&d.append("g").attr("class","xgrid-focus").append("line").attr("class","xgrid-focus").attr("x1",f?0:-10).attr("x2",f?q:-10).attr("y1",f?-10:w).attr("y2",f?-10:t);jc&&d.append("g").attr("class","ygrids");wb&&d.append("g").attr("class","ygrid-lines").selectAll("ygrid-line").data(wb).enter().append("line").attr("class", -function(a){return"ygrid-line "+a["class"]});g.append("g").attr("clip-path",Pa).attr("class","regions");g.append("g").attr("clip-path",Pa).attr("class","chart");g.select(".chart").append("g").attr("class","event-rects").style("fill-opacity",0).style("cursor",na?"ew-resize":null).selectAll(".event-rects").data(a).enter().append("rect").attr("class",function(a,b){return"event-rect event-rect-"+b}).style("cursor",ca&&oa?"pointer":null).on("mouseover",function(a,b){if(!db){var d=k.data.targets.map(function(a){return ga(a.values[b])}), +function(a){return"ygrid-line "+a["class"]});g.append("g").attr("clip-path",Pa).attr("class","regions");g.append("g").attr("clip-path",Pa).attr("class","chart");g.select(".chart").append("g").attr("class","event-rects").style("fill-opacity",0).style("cursor",oa?"ew-resize":null).selectAll(".event-rects").data(a).enter().append("rect").attr("class",function(a,b){return"event-rect event-rect-"+b}).style("cursor",ca&&pa?"pointer":null).on("mouseover",function(a,b){if(!db){var d=k.data.targets.map(function(a){return ha(a.values[b])}), c,h;if(0",d,c,e;for(d=0;d"+ -e+""+c+"";return b+""}),$c=c(["tooltip","init","show"],!1),Ba=c(["tooltip","init","x"],0),oc=c(["tooltip","init","position"],{top:"0px",left:"50px"}),ub=ua.replace("#","")+"-clip",Pa="url(#"+ub+")",A="timeseries"===rc,Y="categorized"===rc,Rb=!A&&ma,zb=null,db=!1,yb=!1,ia=Aa?40:0,la=e.time.format(fd).parse,S=function(a,b){var d=[],c=null!==b?b:"#1f77b4 #ff7f0e #2ca02c #d62728 #9467bd #8c564b #e377c2 #7f7f7f #bcbd22 #17becf".split(" ");return function(b){if(b in +e+""+c+"";return b+""}),$c=c(["tooltip","init","show"],!1),Ba=c(["tooltip","init","x"],0),oc=c(["tooltip","init","position"],{top:"0px",left:"50px"}),ub=ua.replace("#","")+"-clip",Pa="url(#"+ub+")",A="timeseries"===rc,Y="categorized"===rc,Rb=!A&&na,zb=null,db=!1,yb=!1,ja=Aa?40:0,ma=e.time.format(fd).parse,S=function(a,b){var d=[],c=null!==b?b:"#1f77b4 #ff7f0e #2ca02c #d62728 #9467bd #8c564b #e377c2 #7f7f7f #bcbd22 #17becf".split(" ");return function(b){if(b in a)return a[b];-1===d.indexOf(b)&&d.push(b);return c[d.indexOf(b)%c.length]}}(gd,hd),xc=function(){var a=[[e.time.format("%Y/%-m/%-d"),function(){return!0}],[e.time.format("%-m/%-d"),function(a){return a.getMonth()}],[e.time.format("%-m/%-d"),function(a){return 1!==a.getDate()}],[e.time.format("%-m/%-d"),function(a){return a.getDay()&&1!==a.getDate()}],[e.time.format("%I %p"),function(a){return a.getHours()}],[e.time.format("%I:%M"),function(a){return a.getMinutes()}],[e.time.format(":%S"),function(a){return a.getSeconds()}], -[e.time.format(".%L"),function(a){return a.getMilliseconds()}]];return function(b){for(var d=a.length-1,c=a[d];!c[1](b);)c=a[--d];return c[0](b)}}(),Gb,Lb,Ib,Va,Kb,Mb,q,t,ja,hb,va,Nb,Ob,kb,lb,l,z,Q,X,Wa,Xa,J,ka,Ya,Ga,tc=f?"left":"bottom",uc=f?jb?"top":"bottom":jb?"right":"left",vc=f?ib?"bottom":"top":ib?"left":"right",wc="bottom",K={main:function(){return"translate("+I+","+w+")"},context:function(){return"translate("+H+","+Ca+")"},legend:function(){return"translate("+Cb+","+Bb+")"},y2:function(){return"translate("+ -(f?0:q)+","+(f?10:0)+")"},x:function(){return"translate(0,"+t+")"},subx:function(){return"translate(0,"+ja+")"}},bd=function(){var a=e.svg.line().x(f?function(a){return fa(a.id)(a.value)}:bb).y(f?bb:function(a){return fa(a.id)(a.value)});return function(b){var d=fc(b.values),c;if(rb(b))return"spline"===aa["string"===typeof b?b:b.id]?a.interpolate("cardinal"):a.interpolate("linear"),0b.classes.indexOf(a)})});return L};k.data.get=function(a){a=k.data.getAsTarget(a);return n(a)?a.values.map(function(a){return a.value}):void 0};k.data.getAsTarget=function(a){var b= -Za(function(b){return b.id===a});return 0