From c5bb0515ceb6f3fce04a0c36df975426c5daa84a Mon Sep 17 00:00:00 2001 From: Masayuki Tanaka Date: Fri, 18 Oct 2013 11:20:56 +0900 Subject: [PATCH] Enable to specify padding of axis as top and bottom --- c3.js | 13 +++-- c3.min.js | 116 ++++++++++++++++++++++---------------------- htdocs/js/c3.min.js | 116 ++++++++++++++++++++++---------------------- 3 files changed, 126 insertions(+), 119 deletions(-) diff --git a/c3.js b/c3.js index f7e9e2e..5b42e62 100644 --- a/c3.js +++ b/c3.js @@ -403,15 +403,22 @@ yDomainMin = (yMin !== null) ? yMin : getYDomainMin(yTargets), yDomainMax = (yMax !== null) ? yMax : getYDomainMax(yTargets), padding = Math.abs(yDomainMax - yDomainMin) * 0.1, + padding_top = padding, padding_bottom = padding, center = axisId === 'y2' ? __axis_y2_center : __axis_y_center; if (center !== null) { yDomainAbs = Math.max(Math.abs(yDomainMin), Math.abs(yDomainMax)); yDomainMax = yDomainAbs - center; yDomainMin = center - yDomainAbs; } - if (axisId === 'y' && __axis_y_padding !== null) padding = __axis_y_padding; - if (axisId === 'y2' && __axis_y2_padding !== null) padding = __axis_y2_padding; - return [hasBarType(yTargets) ? 0 : yDomainMin-padding, yDomainMax+padding]; + if (axisId === 'y' && __axis_y_padding !== null) { + padding_top = isDefined(__axis_y_padding.top) ? __axis_y_padding.top : padding; + padding_bottom = isDefined(__axis_y_padding.bottom) ? __axis_y_padding.bottom : padding; + } + if (axisId === 'y2' && __axis_y2_padding !== null) { + padding_top = isDefined(__axis_y2_padding.top) ? __axis_y2_padding.top : padding; + padding_bottom = isDefined(__axis_y2_padding.bottom) ? __axis_y2_padding.bottom : padding; + } + return [hasBarType(yTargets) ? 0 : yDomainMin-padding_bottom, yDomainMax+padding_top]; } function getXDomainRatio () { if (brush.empty()) return 1; diff --git a/c3.min.js b/c3.min.js index e68cb7c..12d6b45 100644 --- a/c3.min.js +++ b/c3.min.js @@ -1,61 +1,61 @@ -(function(mb){function nb(){function l(c,k){c.attr("transform",function(c){return"translate("+(k(c)+R)+",0)"})}function u(c,k){c.attr("transform",function(c){return"translate(0,"+k(c)+")"})}function Ca(c){var k=c[0];c=c[c.length-1];return kv[d].indexOf(c.id)))for(e=0;e=s;s+=diffx2)m+=e(a[c-1],a[c],s,k);return m}function cb(a){var b=h.data.targets=L(a),d,c;p.domain(d3.extent(a.map(function(a){return a.x})));x.domain(Da(b,"y"));P.domain(Da(b,"y2"));y.domain(p.domain());Ga.domain(x.domain());Ha.domain(P.domain());E.ticks(10>a.length?a.length:10);ga.ticks(3).outerTickSize(0).tickFormat(tc);Ia.ticks(3).outerTickSize(0).tickFormat(uc);g.append("g").attr("class","x axis").attr("clip-path", -f?"":"url(#xaxis-clip)").attr("transform","translate(0,"+w+")").call(f?ga:E);g.append("g").attr("class","y axis").attr("clip-path",f?"url(#yaxis-clip)":"").call(f?E:ga).append("text").attr("transform","rotate(-90)").attr("dy","1.4em").attr("dx","-.8em").style("text-anchor","end").text(vc);sb&&g.append("g").attr("class","y2 axis").attr("transform","translate("+(f?0:q)+","+(f?10:0)+")").call(Ia);d=g.append("g").attr("clip-path",Oa).attr("class","grid");Qb&&d.append("g").attr("class","xgrids");db&&(c= -d.append("g").attr("class","xgrid-lines").selectAll(".xgrid-line").data(db).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:-t).attr("dy",-6).text(function(a){return a.text}));wc&&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:t).attr("y2",f?-10:w);Rb&&d.append("g").attr("class","ygrids");eb&&d.append("g").attr("class","ygrid-lines").selectAll("ygrid-line").data(eb).enter().append("line").attr("class",function(a){return"ygrid-line "+a["class"]});g.append("g").attr("clip-path",Oa).attr("class","regions");g.append("g").attr("clip-path",Oa).attr("class","chart");g.select(".chart").append("g").attr("class","event-rects").style("fill-opacity",0).selectAll(".event-rects").data(a).enter().append("rect").attr("class", -function(a,b){return"event-rect event-rect-"+b}).style("cursor",function(a){return X&&ba?"pointer":null}).on("mouseover",function(a,b){if(!Pa){var d=h.data.targets.map(function(a){return Ea(a.values[b])}),c,e;if(0u[d].indexOf(c.id)))for(e=0;e=s;s+=diffx2)m+=e(a[c-1],a[c],s,l);return m}function eb(a){var b=k.data.targets=L(a),d,c;l.domain(d3.extent(a.map(function(a){return a.x})));x.domain(E(b,"y"));P.domain(E(b,"y2"));y.domain(l.domain());Ha.domain(x.domain());Ia.domain(P.domain());D.ticks(10>a.length?a.length:10);ga.ticks(3).outerTickSize(0).tickFormat(tc); +Ja.ticks(3).outerTickSize(0).tickFormat(uc);g.append("g").attr("class","x axis").attr("clip-path",f?"":"url(#xaxis-clip)").attr("transform","translate(0,"+w+")").call(f?ga:D);g.append("g").attr("class","y axis").attr("clip-path",f?"url(#yaxis-clip)":"").call(f?D:ga).append("text").attr("transform","rotate(-90)").attr("dy","1.4em").attr("dx","-.8em").style("text-anchor","end").text(vc);ub&&g.append("g").attr("class","y2 axis").attr("transform","translate("+(f?0:p)+","+(f?10:0)+")").call(Ja);d=g.append("g").attr("clip-path", +Pa).attr("class","grid");Qb&&d.append("g").attr("class","xgrids");fb&&(c=d.append("g").attr("class","xgrid-lines").selectAll(".xgrid-line").data(fb).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:-r).attr("dy",-6).text(function(a){return a.text}));wc&&d.append("g").attr("class","xgrid-focus").append("line").attr("class", +"xgrid-focus").attr("x1",f?0:-10).attr("x2",f?p:-10).attr("y1",f?-10:r).attr("y2",f?-10:w);Rb&&d.append("g").attr("class","ygrids");gb&&d.append("g").attr("class","ygrid-lines").selectAll("ygrid-line").data(gb).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).selectAll(".event-rects").data(a).enter().append("rect").attr("class", +function(a,b){return"event-rect event-rect-"+b}).style("cursor",function(a){return X&&ba?"pointer":null}).on("mouseover",function(a,b){if(!Qa){var d=k.data.targets.map(function(a){return Fa(a.values[b])}),c,e;if(0",c,e,f;for(c=0;c"+f+""+e+"";return b+""}),yc=c(["tooltip","init","show"],!1),la=c(["tooltip","init","x"],0),Wb=c(["tooltip","init","position"],{top:"0px",left:"50px"}),kb=z.bindto.replace("#","")+"-clip",Oa="url(#"+kb+")",H="timeseries"===Zb,Ba="categorized"===Zb,gb=null,Pa=!1,$=ka?40:0,Gc=function(a){return function(b){for(var c= +a.values[b.x].value})});ya&&(b=N.select(".chart-bars").selectAll(".chart-bar").data(a),b=b.enter().append("g").attr("class",function(a){return"chart-bar target target-"+a.id}).style("opacity",0),b.append("g").attr("class",Db).style("fill",function(a){return Q(a.id)}),b=N.select(".chart-lines").selectAll(".chart-line").data(a),b=b.enter().append("g").attr("class",function(a){return"chart-line target target-"+a.id}).style("opacity",0),b.append("path").attr("class",Cb).style("stroke",function(a){return Q(a.id)})); +ka&&Ra(a);d3.selectAll(".target").transition().style("opacity",1)}function za(a,b){k.data.targets.forEach(function(b){for(var c=0;c",c,e,f;for(c=0;c"+f+""+e+"";return b+""}),yc=c(["tooltip","init","show"],!1),la=c(["tooltip","init","x"],0),Wb=c(["tooltip","init","position"],{top:"0px",left:"50px"}),mb=z.bindto.replace("#","")+"-clip",Pa="url(#"+mb+")",H="timeseries"===Zb,Da="categorized"===Zb,ib=null,Qa=!1,$=ka?40:0,Gc=function(a){return function(b){for(var c= a.length-1,e=a[c];!e[1](b);)e=a[--c];return e[0](b)}}([[d3.time.format("%Y/%-m/%-d"),function(){return!0}],[d3.time.format("%-m/%-d"),function(a){return a.getMonth()}],[d3.time.format("%-m/%-d"),function(a){return 1!=a.getDate()}],[d3.time.format("%-m/%-d"),function(a){return a.getDay()&&1!=a.getDate()}],[d3.time.format("%I %p"),function(a){return a.getHours()}],[d3.time.format("%I:%M"),function(a){return a.getMinutes()}],[d3.time.format(":%S"),function(a){return a.getSeconds()}],[d3.time.format(".%L"), -function(a){return a.getMilliseconds()}]]),aa=d3.time.format(Dc).parse,pb,ub,rb,tb,vb,q,w,fa,xb,yb,Wa,Xa,p,x,P,y,Ga,Ha,E=Ba?nb():d3.svg.axis(),ga=d3.svg.axis(),Ia=d3.svg.axis(),ha=Ba?nb():d3.svg.axis();O();R();H&&E.tickFormat(Gc);Ba?(E.categories(Ra).tickCentered($b),ha.categories(Ra).tickCentered($b)):(E.tickOffset=function(){return 0},ha.tickOffset=function(){return 0});Ba&&function(){var a=p,b=y,c=Object.keys(p),e,f;p=function(b){return a(b)+E.tickOffset()};y=function(a){return b(a)+ha.tickOffset()}; -for(f=0;fa?0:a},Q=function(a,b){var c=[],e=null!==b?b:"#1f77b4 #ff7f0e #2ca02c #d62728 #9467bd #8c564b #e377c2 #7f7f7f #bcbd22 #17becf".split(" "); -return function(b){if(b in a)return a[b];0<=c.indexOf(b)||c.push(b);return e[c.indexOf(b)%e.length]}}(Ec,Fc),Sa=d3.select(z.bindto).append("svg").attr("width",q+G+D).attr("height",w+t+T),lb=Sa.append("defs");lb.append("clipPath").attr("id",kb).append("rect").attr("y",t).attr("width",q).attr("height",w-t);lb.append("clipPath").attr("id","xaxis-clip").append("rect").attr("x",-1).attr("y",-1).attr("width",q+2).attr("height",40);lb.append("clipPath").attr("id","yaxis-clip").append("rect").attr("x",-G+ -1).attr("y",t-1).attr("width",G).attr("height",w-t+2);var g=Sa.append("g").attr("transform","translate("+G+","+t+")"),N=null;wa&&(N=Sa.append("g").attr("transform","translate("+I+","+ma+")"));var za=null;ka&&(za=Sa.append("g").attr("transform","translate("+Ca+","+ob+")"));var ja=d3.select(z.bindto).style("position","relative").append("div").style("position","absolute").style("width","30%").style("z-index","10").style("visibility","hidden"),ia=d3.svg.brush().x(y).on("brush",function(){J({withTransition:!1, -withY:!1,withSubchart:!1})}),Ma=null,Ya=null;h.focus=function(a){h.defocus();d3.selectAll(Aa(a)).filter(function(a){return Ta(a.id)}).classed("focused",!0).transition().duration(100).style("opacity",1)};h.defocus=function(a){d3.selectAll(Aa(a)).filter(function(a){return Ta(a.id)}).classed("focused",!1).transition().duration(100).style("opacity",0.3)};h.revert=function(a){d3.selectAll(Aa(a)).filter(function(a){return Ta(a.id)}).classed("focused",!1).transition().duration(100).style("opacity",1)};h.show= -function(a){d3.selectAll(Aa(a)).transition().style("opacity",1)};h.hide=function(a){d3.selectAll(Aa(a)).transition().style("opacity",0)};h.load=function(a){u(a.done)&&(a.done=function(){});if("cacheIds"in a&&da(a.cacheIds))xa(ea(a.cacheIds),a.done);else if("data"in a)xa(L(data),a.done);else if("url"in a)d3.csv(a.url,function(b,c){xa(L(c),a.done)});else if("rows"in a)xa(L(na(a.rows)),a.done);else if("columns"in a)xa(L(oa(a.columns)),a.done);else throw Error("url or rows or columns is required.");}; -h.unload=function(a){h.data.targets=h.data.targets.filter(function(b){return b.id!=a});d3.selectAll(".target-"+a).transition().style("opacity",0).remove();ka&&(d3.selectAll(".legend-item-"+a).remove(),Qa(h.data.targets));0b.classes.indexOf(a)})});return K}; -h.data.get=function(a){a=h.data.getAsTarget(a);return l(a)?a.values.map(function(a){return a.value}):void 0};h.data.getAsTarget=function(a){var b=Ja(function(b){return b.id==a});return 0a?0:a},Q=function(a,b){var c=[],e=null!==b?b:"#1f77b4 #ff7f0e #2ca02c #d62728 #9467bd #8c564b #e377c2 #7f7f7f #bcbd22 #17becf".split(" "); +return function(b){if(b in a)return a[b];0<=c.indexOf(b)||c.push(b);return e[c.indexOf(b)%e.length]}}(Ec,Fc),Ta=d3.select(z.bindto).append("svg").attr("width",p+G+C).attr("height",w+r+T),nb=Ta.append("defs");nb.append("clipPath").attr("id",mb).append("rect").attr("y",r).attr("width",p).attr("height",w-r);nb.append("clipPath").attr("id","xaxis-clip").append("rect").attr("x",-1).attr("y",-1).attr("width",p+2).attr("height",40);nb.append("clipPath").attr("id","yaxis-clip").append("rect").attr("x",-G+ +1).attr("y",r-1).attr("width",G).attr("height",w-r+2);var g=Ta.append("g").attr("transform","translate("+G+","+r+")"),N=null;ya&&(N=Ta.append("g").attr("transform","translate("+I+","+ma+")"));var Ba=null;ka&&(Ba=Ta.append("g").attr("transform","translate("+Ea+","+qb+")"));var ja=d3.select(z.bindto).style("position","relative").append("div").style("position","absolute").style("width","30%").style("z-index","10").style("visibility","hidden"),ia=d3.svg.brush().x(y).on("brush",function(){J({withTransition:!1, +withY:!1,withSubchart:!1})}),Na=null,$a=null;k.focus=function(a){k.defocus();d3.selectAll(Ca(a)).filter(function(a){return Va(a.id)}).classed("focused",!0).transition().duration(100).style("opacity",1)};k.defocus=function(a){d3.selectAll(Ca(a)).filter(function(a){return Va(a.id)}).classed("focused",!1).transition().duration(100).style("opacity",0.3)};k.revert=function(a){d3.selectAll(Ca(a)).filter(function(a){return Va(a.id)}).classed("focused",!1).transition().duration(100).style("opacity",1)};k.show= +function(a){d3.selectAll(Ca(a)).transition().style("opacity",1)};k.hide=function(a){d3.selectAll(Ca(a)).transition().style("opacity",0)};k.load=function(a){t(a.done)&&(a.done=function(){});if("cacheIds"in a&&da(a.cacheIds))za(ea(a.cacheIds),a.done);else if("data"in a)za(L(data),a.done);else if("url"in a)d3.csv(a.url,function(b,c){za(L(c),a.done)});else if("rows"in a)za(L(na(a.rows)),a.done);else if("columns"in a)za(L(oa(a.columns)),a.done);else throw Error("url or rows or columns is required.");}; +k.unload=function(a){k.data.targets=k.data.targets.filter(function(b){return b.id!=a});d3.selectAll(".target-"+a).transition().style("opacity",0).remove();ka&&(d3.selectAll(".legend-item-"+a).remove(),Ra(k.data.targets));0b.classes.indexOf(a)})});return K}; +k.data.get=function(a){a=k.data.getAsTarget(a);return h(a)?a.values.map(function(a){return a.value}):void 0};k.data.getAsTarget=function(a){var b=Ka(function(b){return b.id==a});return 0v[d].indexOf(c.id)))for(e=0;e=s;s+=diffx2)m+=e(a[c-1],a[c],s,k);return m}function cb(a){var b=h.data.targets=L(a),d,c;p.domain(d3.extent(a.map(function(a){return a.x})));x.domain(Da(b,"y"));P.domain(Da(b,"y2"));y.domain(p.domain());Ga.domain(x.domain());Ha.domain(P.domain());E.ticks(10>a.length?a.length:10);ga.ticks(3).outerTickSize(0).tickFormat(tc);Ia.ticks(3).outerTickSize(0).tickFormat(uc);g.append("g").attr("class","x axis").attr("clip-path", -f?"":"url(#xaxis-clip)").attr("transform","translate(0,"+w+")").call(f?ga:E);g.append("g").attr("class","y axis").attr("clip-path",f?"url(#yaxis-clip)":"").call(f?E:ga).append("text").attr("transform","rotate(-90)").attr("dy","1.4em").attr("dx","-.8em").style("text-anchor","end").text(vc);sb&&g.append("g").attr("class","y2 axis").attr("transform","translate("+(f?0:q)+","+(f?10:0)+")").call(Ia);d=g.append("g").attr("clip-path",Oa).attr("class","grid");Qb&&d.append("g").attr("class","xgrids");db&&(c= -d.append("g").attr("class","xgrid-lines").selectAll(".xgrid-line").data(db).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:-t).attr("dy",-6).text(function(a){return a.text}));wc&&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:t).attr("y2",f?-10:w);Rb&&d.append("g").attr("class","ygrids");eb&&d.append("g").attr("class","ygrid-lines").selectAll("ygrid-line").data(eb).enter().append("line").attr("class",function(a){return"ygrid-line "+a["class"]});g.append("g").attr("clip-path",Oa).attr("class","regions");g.append("g").attr("clip-path",Oa).attr("class","chart");g.select(".chart").append("g").attr("class","event-rects").style("fill-opacity",0).selectAll(".event-rects").data(a).enter().append("rect").attr("class", -function(a,b){return"event-rect event-rect-"+b}).style("cursor",function(a){return X&&ba?"pointer":null}).on("mouseover",function(a,b){if(!Pa){var d=h.data.targets.map(function(a){return Ea(a.values[b])}),c,e;if(0u[d].indexOf(c.id)))for(e=0;e=s;s+=diffx2)m+=e(a[c-1],a[c],s,l);return m}function eb(a){var b=k.data.targets=L(a),d,c;l.domain(d3.extent(a.map(function(a){return a.x})));x.domain(E(b,"y"));P.domain(E(b,"y2"));y.domain(l.domain());Ha.domain(x.domain());Ia.domain(P.domain());D.ticks(10>a.length?a.length:10);ga.ticks(3).outerTickSize(0).tickFormat(tc); +Ja.ticks(3).outerTickSize(0).tickFormat(uc);g.append("g").attr("class","x axis").attr("clip-path",f?"":"url(#xaxis-clip)").attr("transform","translate(0,"+w+")").call(f?ga:D);g.append("g").attr("class","y axis").attr("clip-path",f?"url(#yaxis-clip)":"").call(f?D:ga).append("text").attr("transform","rotate(-90)").attr("dy","1.4em").attr("dx","-.8em").style("text-anchor","end").text(vc);ub&&g.append("g").attr("class","y2 axis").attr("transform","translate("+(f?0:p)+","+(f?10:0)+")").call(Ja);d=g.append("g").attr("clip-path", +Pa).attr("class","grid");Qb&&d.append("g").attr("class","xgrids");fb&&(c=d.append("g").attr("class","xgrid-lines").selectAll(".xgrid-line").data(fb).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:-r).attr("dy",-6).text(function(a){return a.text}));wc&&d.append("g").attr("class","xgrid-focus").append("line").attr("class", +"xgrid-focus").attr("x1",f?0:-10).attr("x2",f?p:-10).attr("y1",f?-10:r).attr("y2",f?-10:w);Rb&&d.append("g").attr("class","ygrids");gb&&d.append("g").attr("class","ygrid-lines").selectAll("ygrid-line").data(gb).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).selectAll(".event-rects").data(a).enter().append("rect").attr("class", +function(a,b){return"event-rect event-rect-"+b}).style("cursor",function(a){return X&&ba?"pointer":null}).on("mouseover",function(a,b){if(!Qa){var d=k.data.targets.map(function(a){return Fa(a.values[b])}),c,e;if(0",c,e,f;for(c=0;c"+f+""+e+"";return b+""}),yc=c(["tooltip","init","show"],!1),la=c(["tooltip","init","x"],0),Wb=c(["tooltip","init","position"],{top:"0px",left:"50px"}),kb=z.bindto.replace("#","")+"-clip",Oa="url(#"+kb+")",H="timeseries"===Zb,Ba="categorized"===Zb,gb=null,Pa=!1,$=ka?40:0,Gc=function(a){return function(b){for(var c= +a.values[b.x].value})});ya&&(b=N.select(".chart-bars").selectAll(".chart-bar").data(a),b=b.enter().append("g").attr("class",function(a){return"chart-bar target target-"+a.id}).style("opacity",0),b.append("g").attr("class",Db).style("fill",function(a){return Q(a.id)}),b=N.select(".chart-lines").selectAll(".chart-line").data(a),b=b.enter().append("g").attr("class",function(a){return"chart-line target target-"+a.id}).style("opacity",0),b.append("path").attr("class",Cb).style("stroke",function(a){return Q(a.id)})); +ka&&Ra(a);d3.selectAll(".target").transition().style("opacity",1)}function za(a,b){k.data.targets.forEach(function(b){for(var c=0;c",c,e,f;for(c=0;c"+f+""+e+"";return b+""}),yc=c(["tooltip","init","show"],!1),la=c(["tooltip","init","x"],0),Wb=c(["tooltip","init","position"],{top:"0px",left:"50px"}),mb=z.bindto.replace("#","")+"-clip",Pa="url(#"+mb+")",H="timeseries"===Zb,Da="categorized"===Zb,ib=null,Qa=!1,$=ka?40:0,Gc=function(a){return function(b){for(var c= a.length-1,e=a[c];!e[1](b);)e=a[--c];return e[0](b)}}([[d3.time.format("%Y/%-m/%-d"),function(){return!0}],[d3.time.format("%-m/%-d"),function(a){return a.getMonth()}],[d3.time.format("%-m/%-d"),function(a){return 1!=a.getDate()}],[d3.time.format("%-m/%-d"),function(a){return a.getDay()&&1!=a.getDate()}],[d3.time.format("%I %p"),function(a){return a.getHours()}],[d3.time.format("%I:%M"),function(a){return a.getMinutes()}],[d3.time.format(":%S"),function(a){return a.getSeconds()}],[d3.time.format(".%L"), -function(a){return a.getMilliseconds()}]]),aa=d3.time.format(Dc).parse,pb,ub,rb,tb,vb,q,w,fa,xb,yb,Wa,Xa,p,x,P,y,Ga,Ha,E=Ba?nb():d3.svg.axis(),ga=d3.svg.axis(),Ia=d3.svg.axis(),ha=Ba?nb():d3.svg.axis();O();R();H&&E.tickFormat(Gc);Ba?(E.categories(Ra).tickCentered($b),ha.categories(Ra).tickCentered($b)):(E.tickOffset=function(){return 0},ha.tickOffset=function(){return 0});Ba&&function(){var a=p,b=y,c=Object.keys(p),e,f;p=function(b){return a(b)+E.tickOffset()};y=function(a){return b(a)+ha.tickOffset()}; -for(f=0;fa?0:a},Q=function(a,b){var c=[],e=null!==b?b:"#1f77b4 #ff7f0e #2ca02c #d62728 #9467bd #8c564b #e377c2 #7f7f7f #bcbd22 #17becf".split(" "); -return function(b){if(b in a)return a[b];0<=c.indexOf(b)||c.push(b);return e[c.indexOf(b)%e.length]}}(Ec,Fc),Sa=d3.select(z.bindto).append("svg").attr("width",q+G+D).attr("height",w+t+T),lb=Sa.append("defs");lb.append("clipPath").attr("id",kb).append("rect").attr("y",t).attr("width",q).attr("height",w-t);lb.append("clipPath").attr("id","xaxis-clip").append("rect").attr("x",-1).attr("y",-1).attr("width",q+2).attr("height",40);lb.append("clipPath").attr("id","yaxis-clip").append("rect").attr("x",-G+ -1).attr("y",t-1).attr("width",G).attr("height",w-t+2);var g=Sa.append("g").attr("transform","translate("+G+","+t+")"),N=null;wa&&(N=Sa.append("g").attr("transform","translate("+I+","+ma+")"));var za=null;ka&&(za=Sa.append("g").attr("transform","translate("+Ca+","+ob+")"));var ja=d3.select(z.bindto).style("position","relative").append("div").style("position","absolute").style("width","30%").style("z-index","10").style("visibility","hidden"),ia=d3.svg.brush().x(y).on("brush",function(){J({withTransition:!1, -withY:!1,withSubchart:!1})}),Ma=null,Ya=null;h.focus=function(a){h.defocus();d3.selectAll(Aa(a)).filter(function(a){return Ta(a.id)}).classed("focused",!0).transition().duration(100).style("opacity",1)};h.defocus=function(a){d3.selectAll(Aa(a)).filter(function(a){return Ta(a.id)}).classed("focused",!1).transition().duration(100).style("opacity",0.3)};h.revert=function(a){d3.selectAll(Aa(a)).filter(function(a){return Ta(a.id)}).classed("focused",!1).transition().duration(100).style("opacity",1)};h.show= -function(a){d3.selectAll(Aa(a)).transition().style("opacity",1)};h.hide=function(a){d3.selectAll(Aa(a)).transition().style("opacity",0)};h.load=function(a){u(a.done)&&(a.done=function(){});if("cacheIds"in a&&da(a.cacheIds))xa(ea(a.cacheIds),a.done);else if("data"in a)xa(L(data),a.done);else if("url"in a)d3.csv(a.url,function(b,c){xa(L(c),a.done)});else if("rows"in a)xa(L(na(a.rows)),a.done);else if("columns"in a)xa(L(oa(a.columns)),a.done);else throw Error("url or rows or columns is required.");}; -h.unload=function(a){h.data.targets=h.data.targets.filter(function(b){return b.id!=a});d3.selectAll(".target-"+a).transition().style("opacity",0).remove();ka&&(d3.selectAll(".legend-item-"+a).remove(),Qa(h.data.targets));0b.classes.indexOf(a)})});return K}; -h.data.get=function(a){a=h.data.getAsTarget(a);return l(a)?a.values.map(function(a){return a.value}):void 0};h.data.getAsTarget=function(a){var b=Ja(function(b){return b.id==a});return 0a?0:a},Q=function(a,b){var c=[],e=null!==b?b:"#1f77b4 #ff7f0e #2ca02c #d62728 #9467bd #8c564b #e377c2 #7f7f7f #bcbd22 #17becf".split(" "); +return function(b){if(b in a)return a[b];0<=c.indexOf(b)||c.push(b);return e[c.indexOf(b)%e.length]}}(Ec,Fc),Ta=d3.select(z.bindto).append("svg").attr("width",p+G+C).attr("height",w+r+T),nb=Ta.append("defs");nb.append("clipPath").attr("id",mb).append("rect").attr("y",r).attr("width",p).attr("height",w-r);nb.append("clipPath").attr("id","xaxis-clip").append("rect").attr("x",-1).attr("y",-1).attr("width",p+2).attr("height",40);nb.append("clipPath").attr("id","yaxis-clip").append("rect").attr("x",-G+ +1).attr("y",r-1).attr("width",G).attr("height",w-r+2);var g=Ta.append("g").attr("transform","translate("+G+","+r+")"),N=null;ya&&(N=Ta.append("g").attr("transform","translate("+I+","+ma+")"));var Ba=null;ka&&(Ba=Ta.append("g").attr("transform","translate("+Ea+","+qb+")"));var ja=d3.select(z.bindto).style("position","relative").append("div").style("position","absolute").style("width","30%").style("z-index","10").style("visibility","hidden"),ia=d3.svg.brush().x(y).on("brush",function(){J({withTransition:!1, +withY:!1,withSubchart:!1})}),Na=null,$a=null;k.focus=function(a){k.defocus();d3.selectAll(Ca(a)).filter(function(a){return Va(a.id)}).classed("focused",!0).transition().duration(100).style("opacity",1)};k.defocus=function(a){d3.selectAll(Ca(a)).filter(function(a){return Va(a.id)}).classed("focused",!1).transition().duration(100).style("opacity",0.3)};k.revert=function(a){d3.selectAll(Ca(a)).filter(function(a){return Va(a.id)}).classed("focused",!1).transition().duration(100).style("opacity",1)};k.show= +function(a){d3.selectAll(Ca(a)).transition().style("opacity",1)};k.hide=function(a){d3.selectAll(Ca(a)).transition().style("opacity",0)};k.load=function(a){t(a.done)&&(a.done=function(){});if("cacheIds"in a&&da(a.cacheIds))za(ea(a.cacheIds),a.done);else if("data"in a)za(L(data),a.done);else if("url"in a)d3.csv(a.url,function(b,c){za(L(c),a.done)});else if("rows"in a)za(L(na(a.rows)),a.done);else if("columns"in a)za(L(oa(a.columns)),a.done);else throw Error("url or rows or columns is required.");}; +k.unload=function(a){k.data.targets=k.data.targets.filter(function(b){return b.id!=a});d3.selectAll(".target-"+a).transition().style("opacity",0).remove();ka&&(d3.selectAll(".legend-item-"+a).remove(),Ra(k.data.targets));0b.classes.indexOf(a)})});return K}; +k.data.get=function(a){a=k.data.getAsTarget(a);return h(a)?a.values.map(function(a){return a.value}):void 0};k.data.getAsTarget=function(a){var b=Ka(function(b){return b.id==a});return 0