From e92b76f6ffb108c5662f7b176c5a53481a0e902a Mon Sep 17 00:00:00 2001 From: Masayuki Tanaka Date: Sat, 19 Oct 2013 15:38:26 +0900 Subject: [PATCH] Add axis x default and remove subchart default --- c3.js | 15 +++--- c3.min.js | 114 ++++++++++++++++++++++---------------------- htdocs/js/c3.min.js | 114 ++++++++++++++++++++++---------------------- 3 files changed, 121 insertions(+), 122 deletions(-) diff --git a/c3.js b/c3.js index d20e1e4..3d215c0 100644 --- a/c3.js +++ b/c3.js @@ -51,8 +51,7 @@ // subchart var __subchart_show = getConfig(['subchart','show'], false), - __subchart_size_height = __subchart_show ? getConfig(['subchart','size','height'], 60) : 0, - __subchart_default = getConfig(['subchart','default'], null); + __subchart_size_height = __subchart_show ? getConfig(['subchart','size','height'], 60) : 0; // color var __color_pattern = getConfig(['color','pattern'], null); @@ -66,6 +65,7 @@ var __axis_x_type = getConfig(['axis','x','type'], 'indexed'), __axis_x_categories = getConfig(['axis','x','categories'], []), __axis_x_tick_centered = getConfig(['axis','x','tick','centered'], false), + __axis_x_default = getConfig(['axis','x','default'], null), __axis_y_max = getConfig(['axis','y','max'], null), __axis_y_min = getConfig(['axis','y','min'], null), __axis_y_center = getConfig(['axis','y','center'], null), @@ -1156,6 +1156,11 @@ main.select(".chart").append("g") .attr("class", "chart-lines"); + // Set default extent if defined + if (__axis_x_default !== null) { + brush.extent(typeof __axis_x_default !== 'function' ? __axis_x_default : (isTimeSeries ? __axis_x_default(firstDate,lastDate) : __axis_x_default(0,maxDataCount()-1))); + } + /*-- Context Region --*/ if (__subchart_show) { @@ -1172,12 +1177,6 @@ context.select(".chart").append("g") .attr("class", "chart-lines"); - // ATTENTION: This must be called AFTER chart rendered and BEFORE brush called. - // Update extetn for Brush - if (__subchart_default !== null) { - brush.extent((isTimeSeries) ? __subchart_default(firstDate,lastDate) : __subchart_default(0,maxDataCount()-1)); - } - // Add extent rect for Brush context.append("g") .attr("class", "x brush") diff --git a/c3.min.js b/c3.min.js index 2157d96..74671e0 100644 --- a/c3.min.js +++ b/c3.min.js @@ -1,62 +1,62 @@ -(function(pb){function qb(){function k(c,Ua){c.attr("transform",function(c){return"translate("+(Ua(c)+S)+",0)"})}function u(c,k){c.attr("transform",function(c){return"translate(0,"+k(c)+")"})}function Ea(c){var k=c[0];c=c[c.length-1];return kr[d].indexOf(c.id)))for(g=0;gr[d].indexOf(c.id)))for(g=0;g=s;s+=diffx2)q+=c(a[f-1],a[f],s,m);return q}function Tb(){return"translate("+(e?0:t)+","+(e?10:0)+")"}function eb(a){var b=l.data.targets=M(a),d,c;m.domain(d3.extent(a.map(function(a){return a.x})));x.domain(E(b,"y"));Q.domain(E(b,"y2"));y.domain(m.domain()); -Ha.domain(x.domain());Ia.domain(Q.domain());D.ticks(10>a.length?a.length:10);ja.ticks(xc).outerTickSize(0).tickFormat(yc);Ja.ticks(zc).outerTickSize(0).tickFormat(Ac);Cb=m.domain();fb.x(m);h.append("g").attr("class","x axis").attr("clip-path",e?"":"url(#xaxis-clip)").attr("transform","translate(0,"+v+")").call(e?ja:D);h.append("g").attr("class","y axis").attr("clip-path",e?"url(#yaxis-clip)":"").call(e?D:ja).append("text").attr("transform","rotate(-90)").attr("dy","1.4em").attr("dx","-.8em").style("text-anchor", -"end").text(Bc);vb&&h.append("g").attr("class","y2 axis").attr("transform",Tb).call(Ja);d=h.append("g").attr("clip-path",Pa).attr("class","grid");Ub&&d.append("g").attr("class","xgrids");gb&&(c=d.append("g").attr("class","xgrid-lines").selectAll(".xgrid-line").data(gb).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",e?"":"rotate(-90)").attr("dx", -e?0:-p).attr("dy",-6).text(function(a){return a.text}));Cc&&d.append("g").attr("class","xgrid-focus").append("line").attr("class","xgrid-focus").attr("x1",e?0:-10).attr("x2",e?t:-10).attr("y1",e?-10:p).attr("y2",e?-10:v);Vb&&d.append("g").attr("class","ygrids");hb&&d.append("g").attr("class","ygrid-lines").selectAll("ygrid-line").data(hb).enter().append("line").attr("class",function(a){return"ygrid-line "+a["class"]});h.append("g").attr("clip-path",Pa).attr("class","regions");h.append("g").attr("clip-path", -Pa).attr("class","chart");h.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&&ca?"pointer":null}).on("mouseover",function(a,b){if(!Qa){var d=l.data.targets.map(function(a){return Fa(a.values[b])}),c,g;if(0=s;s+=diffx2)q+=c(a[f-1],a[f],s,m);return q}function Tb(){return"translate("+(e?0:t)+","+(e?10:0)+")"}function fb(a){var b=l.data.targets=M(a),d,c;m.domain(d3.extent(a.map(function(a){return a.x})));x.domain(E(b,"y"));Q.domain(E(b,"y2"));y.domain(m.domain()); +Ia.domain(x.domain());Ja.domain(Q.domain());D.ticks(10>a.length?a.length:10);ja.ticks(xc).outerTickSize(0).tickFormat(yc);Ka.ticks(zc).outerTickSize(0).tickFormat(Ac);Cb=m.domain();gb.x(m);h.append("g").attr("class","x axis").attr("clip-path",e?"":"url(#xaxis-clip)").attr("transform","translate(0,"+v+")").call(e?ja:D);h.append("g").attr("class","y axis").attr("clip-path",e?"url(#yaxis-clip)":"").call(e?D:ja).append("text").attr("transform","rotate(-90)").attr("dy","1.4em").attr("dx","-.8em").style("text-anchor", +"end").text(Bc);vb&&h.append("g").attr("class","y2 axis").attr("transform",Tb).call(Ka);d=h.append("g").attr("clip-path",Qa).attr("class","grid");Ub&&d.append("g").attr("class","xgrids");hb&&(c=d.append("g").attr("class","xgrid-lines").selectAll(".xgrid-line").data(hb).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",e?"":"rotate(-90)").attr("dx", +e?0:-p).attr("dy",-6).text(function(a){return a.text}));Cc&&d.append("g").attr("class","xgrid-focus").append("line").attr("class","xgrid-focus").attr("x1",e?0:-10).attr("x2",e?t:-10).attr("y1",e?-10:p).attr("y2",e?-10:v);Vb&&d.append("g").attr("class","ygrids");ib&&d.append("g").attr("class","ygrid-lines").selectAll("ygrid-line").data(ib).enter().append("line").attr("class",function(a){return"ygrid-line "+a["class"]});h.append("g").attr("clip-path",Qa).attr("class","regions");h.append("g").attr("clip-path", +Qa).attr("class","chart");h.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&&ca?"pointer":null}).on("mouseover",function(a,b){if(!Ra){var d=l.data.targets.map(function(a){return Ga(a.values[b])}),c,g;if(0",d,c,f;for(d=0;d"+f+""+c+"";return b+""}), -Ec=c(["tooltip","init","show"],!1),oa=c(["tooltip","init","x"],0),$b=c(["tooltip","init","position"],{top:"0px",left:"50px"}),nb=z.bindto.replace("#","")+"-clip",Pa="url(#"+nb+")",H="timeseries"===cc,fa="categorized"===cc,jb=null,Qa=!1,aa=na?40:0,Mc=function(a){return function(b){for(var d=a.length-1,c=a[d];!c[1](b);)c=a[--d];return c[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()}]]),ba=d3.time.format(Jc).parse,sb,xb,ub,wb,yb,t,v,ia,Ab,Bb,Ya,Za,m,x,Q,y,Ha,Ia,D=fa?qb():d3.svg.axis(),ja=d3.svg.axis(),Ja=d3.svg.axis(),ka=fa?qb():d3.svg.axis();P();S(); -H&&D.tickFormat(Mc);fa?(D.categories(Sa).tickCentered(dc),ka.categories(Sa).tickCentered(dc)):(D.tickOffset=function(){return 0},ka.tickOffset=function(){return 0});fa&&function(){var a=m,b=y,c=Object.keys(m),g,f;m=function(b){return a(b)+D.tickOffset()};y=function(a){return b(a)+ka.tickOffset()};for(f=0;fa?0:a},R=function(a,b){var c=[],g=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 g[c.indexOf(b)%g.length]}}(Kc,Lc),Ta=d3.select(z.bindto).append("svg").attr("width",t+G+C).attr("height",v+p+T),ob=Ta.append("defs"); -ob.append("clipPath").attr("id",nb).append("rect").attr("y",p).attr("width",t).attr("height",v-p);ob.append("clipPath").attr("id","xaxis-clip").append("rect").attr("x",-1).attr("y",-1).attr("width",t+2).attr("height",40);ob.append("clipPath").attr("id","yaxis-clip").append("rect").attr("x",-G+1).attr("y",p-1).attr("width",G).attr("height",v-p+2);var h=Ta.append("g").attr("transform","translate("+G+","+p+")"),O=null;la&&(O=Ta.append("g").attr("transform","translate("+J+","+pa+")"));var Ca=null;na&& -(Ca=Ta.append("g").attr("transform","translate("+Ea+","+rb+")"));var da=d3.select(z.bindto).style("position","relative").append("div").style("position","absolute").style("width","30%").style("z-index","10").style("visibility","hidden"),ma=d3.svg.brush().x(y).on("brush",function(){I({withTransition:!1,withY:!1,withSubchart:!1})}),fb=d3.behavior.zoom().on("zoom",function(){I({withTransition:!1,withY:!1,withSubchart:!1,withUpdateXDomain:!1})}),Na=null,$a=null,Cb;l.focus=function(a){l.defocus();d3.selectAll(Da(a)).filter(function(a){return Va(a.id)}).classed("focused", -!0).transition().duration(100).style("opacity",1)};l.defocus=function(a){d3.selectAll(Da(a)).filter(function(a){return Va(a.id)}).classed("focused",!1).transition().duration(100).style("opacity",0.3)};l.revert=function(a){d3.selectAll(Da(a)).filter(function(a){return Va(a.id)}).classed("focused",!1).transition().duration(100).style("opacity",1)};l.show=function(a){d3.selectAll(Da(a)).transition().style("opacity",1)};l.hide=function(a){d3.selectAll(Da(a)).transition().style("opacity",0)};l.load=function(a){u(a.done)&& -(a.done=function(){});if("cacheIds"in a&&ga(a.cacheIds))Aa(ha(a.cacheIds),a.done);else if("data"in a)Aa(M(data),a.done);else if("url"in a)d3.csv(a.url,function(b,c){Aa(M(c),a.done)});else if("rows"in a)Aa(M(qa(a.rows)),a.done);else if("columns"in a)Aa(M(ra(a.columns)),a.done);else throw Error("url or rows or columns is required.");};l.unload=function(a){l.data.targets=l.data.targets.filter(function(b){return b.id!=a});d3.selectAll(".target-"+a).transition().style("opacity",0).remove();na&&(d3.selectAll(".legend-item-"+ -a).remove(),Ra(l.data.targets));0",d,c,f;for(d=0;d"+f+""+c+"";return b+""}), +Ec=c(["tooltip","init","show"],!1),oa=c(["tooltip","init","x"],0),$b=c(["tooltip","init","position"],{top:"0px",left:"50px"}),nb=z.bindto.replace("#","")+"-clip",Qa="url(#"+nb+")",H="timeseries"===cc,fa="categorized"===cc,kb=null,Ra=!1,aa=na?40:0,Mc=function(a){return function(b){for(var d=a.length-1,c=a[d];!c[1](b);)c=a[--d];return c[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()}]]),ba=d3.time.format(Jc).parse,sb,xb,ub,wb,yb,t,v,ia,Ab,Bb,Za,$a,m,x,Q,y,Ia,Ja,D=fa?qb():d3.svg.axis(),ja=d3.svg.axis(),Ka=d3.svg.axis(),ka=fa?qb():d3.svg.axis();P();S(); +H&&D.tickFormat(Mc);fa?(D.categories(Ta).tickCentered(dc),ka.categories(Ta).tickCentered(dc)):(D.tickOffset=function(){return 0},ka.tickOffset=function(){return 0});fa&&function(){var a=m,b=y,c=Object.keys(m),g,f;m=function(b){return a(b)+D.tickOffset()};y=function(a){return b(a)+ka.tickOffset()};for(f=0;fa?0:a},R=function(a,b){var c=[],g=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 g[c.indexOf(b)%g.length]}}(Kc,Lc),Ua=d3.select(z.bindto).append("svg").attr("width",t+G+C).attr("height",v+p+T),ob=Ua.append("defs"); +ob.append("clipPath").attr("id",nb).append("rect").attr("y",p).attr("width",t).attr("height",v-p);ob.append("clipPath").attr("id","xaxis-clip").append("rect").attr("x",-1).attr("y",-1).attr("width",t+2).attr("height",40);ob.append("clipPath").attr("id","yaxis-clip").append("rect").attr("x",-G+1).attr("y",p-1).attr("width",G).attr("height",v-p+2);var h=Ua.append("g").attr("transform","translate("+G+","+p+")"),O=null;la&&(O=Ua.append("g").attr("transform","translate("+J+","+pa+")"));var Da=null;na&& +(Da=Ua.append("g").attr("transform","translate("+Fa+","+rb+")"));var da=d3.select(z.bindto).style("position","relative").append("div").style("position","absolute").style("width","30%").style("z-index","10").style("visibility","hidden"),ma=d3.svg.brush().x(y).on("brush",function(){I({withTransition:!1,withY:!1,withSubchart:!1})}),gb=d3.behavior.zoom().on("zoom",function(){I({withTransition:!1,withY:!1,withSubchart:!1,withUpdateXDomain:!1})}),Oa=null,ab=null,Cb;l.focus=function(a){l.defocus();d3.selectAll(Ea(a)).filter(function(a){return Wa(a.id)}).classed("focused", +!0).transition().duration(100).style("opacity",1)};l.defocus=function(a){d3.selectAll(Ea(a)).filter(function(a){return Wa(a.id)}).classed("focused",!1).transition().duration(100).style("opacity",0.3)};l.revert=function(a){d3.selectAll(Ea(a)).filter(function(a){return Wa(a.id)}).classed("focused",!1).transition().duration(100).style("opacity",1)};l.show=function(a){d3.selectAll(Ea(a)).transition().style("opacity",1)};l.hide=function(a){d3.selectAll(Ea(a)).transition().style("opacity",0)};l.load=function(a){u(a.done)&& +(a.done=function(){});if("cacheIds"in a&&ga(a.cacheIds))Ba(ha(a.cacheIds),a.done);else if("data"in a)Ba(M(data),a.done);else if("url"in a)d3.csv(a.url,function(b,c){Ba(M(c),a.done)});else if("rows"in a)Ba(M(qa(a.rows)),a.done);else if("columns"in a)Ba(M(ra(a.columns)),a.done);else throw Error("url or rows or columns is required.");};l.unload=function(a){l.data.targets=l.data.targets.filter(function(b){return b.id!=a});d3.selectAll(".target-"+a).transition().style("opacity",0).remove();na&&(d3.selectAll(".legend-item-"+ +a).remove(),Sa(l.data.targets));0b.classes.indexOf(a)})});return K};l.data.get=function(a){a=l.data.getAsTarget(a);return k(a)?a.values.map(function(a){return a.value}):void 0};l.data.getAsTarget=function(a){var b= -Ka(function(b){return b.id==a});return 0r[d].indexOf(c.id)))for(g=0;gr[d].indexOf(c.id)))for(g=0;g=s;s+=diffx2)q+=c(a[f-1],a[f],s,m);return q}function Tb(){return"translate("+(e?0:t)+","+(e?10:0)+")"}function eb(a){var b=l.data.targets=M(a),d,c;m.domain(d3.extent(a.map(function(a){return a.x})));x.domain(E(b,"y"));Q.domain(E(b,"y2"));y.domain(m.domain()); -Ha.domain(x.domain());Ia.domain(Q.domain());D.ticks(10>a.length?a.length:10);ja.ticks(xc).outerTickSize(0).tickFormat(yc);Ja.ticks(zc).outerTickSize(0).tickFormat(Ac);Cb=m.domain();fb.x(m);h.append("g").attr("class","x axis").attr("clip-path",e?"":"url(#xaxis-clip)").attr("transform","translate(0,"+v+")").call(e?ja:D);h.append("g").attr("class","y axis").attr("clip-path",e?"url(#yaxis-clip)":"").call(e?D:ja).append("text").attr("transform","rotate(-90)").attr("dy","1.4em").attr("dx","-.8em").style("text-anchor", -"end").text(Bc);vb&&h.append("g").attr("class","y2 axis").attr("transform",Tb).call(Ja);d=h.append("g").attr("clip-path",Pa).attr("class","grid");Ub&&d.append("g").attr("class","xgrids");gb&&(c=d.append("g").attr("class","xgrid-lines").selectAll(".xgrid-line").data(gb).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",e?"":"rotate(-90)").attr("dx", -e?0:-p).attr("dy",-6).text(function(a){return a.text}));Cc&&d.append("g").attr("class","xgrid-focus").append("line").attr("class","xgrid-focus").attr("x1",e?0:-10).attr("x2",e?t:-10).attr("y1",e?-10:p).attr("y2",e?-10:v);Vb&&d.append("g").attr("class","ygrids");hb&&d.append("g").attr("class","ygrid-lines").selectAll("ygrid-line").data(hb).enter().append("line").attr("class",function(a){return"ygrid-line "+a["class"]});h.append("g").attr("clip-path",Pa).attr("class","regions");h.append("g").attr("clip-path", -Pa).attr("class","chart");h.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&&ca?"pointer":null}).on("mouseover",function(a,b){if(!Qa){var d=l.data.targets.map(function(a){return Fa(a.values[b])}),c,g;if(0=s;s+=diffx2)q+=c(a[f-1],a[f],s,m);return q}function Tb(){return"translate("+(e?0:t)+","+(e?10:0)+")"}function fb(a){var b=l.data.targets=M(a),d,c;m.domain(d3.extent(a.map(function(a){return a.x})));x.domain(E(b,"y"));Q.domain(E(b,"y2"));y.domain(m.domain()); +Ia.domain(x.domain());Ja.domain(Q.domain());D.ticks(10>a.length?a.length:10);ja.ticks(xc).outerTickSize(0).tickFormat(yc);Ka.ticks(zc).outerTickSize(0).tickFormat(Ac);Cb=m.domain();gb.x(m);h.append("g").attr("class","x axis").attr("clip-path",e?"":"url(#xaxis-clip)").attr("transform","translate(0,"+v+")").call(e?ja:D);h.append("g").attr("class","y axis").attr("clip-path",e?"url(#yaxis-clip)":"").call(e?D:ja).append("text").attr("transform","rotate(-90)").attr("dy","1.4em").attr("dx","-.8em").style("text-anchor", +"end").text(Bc);vb&&h.append("g").attr("class","y2 axis").attr("transform",Tb).call(Ka);d=h.append("g").attr("clip-path",Qa).attr("class","grid");Ub&&d.append("g").attr("class","xgrids");hb&&(c=d.append("g").attr("class","xgrid-lines").selectAll(".xgrid-line").data(hb).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",e?"":"rotate(-90)").attr("dx", +e?0:-p).attr("dy",-6).text(function(a){return a.text}));Cc&&d.append("g").attr("class","xgrid-focus").append("line").attr("class","xgrid-focus").attr("x1",e?0:-10).attr("x2",e?t:-10).attr("y1",e?-10:p).attr("y2",e?-10:v);Vb&&d.append("g").attr("class","ygrids");ib&&d.append("g").attr("class","ygrid-lines").selectAll("ygrid-line").data(ib).enter().append("line").attr("class",function(a){return"ygrid-line "+a["class"]});h.append("g").attr("clip-path",Qa).attr("class","regions");h.append("g").attr("clip-path", +Qa).attr("class","chart");h.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&&ca?"pointer":null}).on("mouseover",function(a,b){if(!Ra){var d=l.data.targets.map(function(a){return Ga(a.values[b])}),c,g;if(0",d,c,f;for(d=0;d"+f+""+c+"";return b+""}), -Ec=c(["tooltip","init","show"],!1),oa=c(["tooltip","init","x"],0),$b=c(["tooltip","init","position"],{top:"0px",left:"50px"}),nb=z.bindto.replace("#","")+"-clip",Pa="url(#"+nb+")",H="timeseries"===cc,fa="categorized"===cc,jb=null,Qa=!1,aa=na?40:0,Mc=function(a){return function(b){for(var d=a.length-1,c=a[d];!c[1](b);)c=a[--d];return c[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()}]]),ba=d3.time.format(Jc).parse,sb,xb,ub,wb,yb,t,v,ia,Ab,Bb,Ya,Za,m,x,Q,y,Ha,Ia,D=fa?qb():d3.svg.axis(),ja=d3.svg.axis(),Ja=d3.svg.axis(),ka=fa?qb():d3.svg.axis();P();S(); -H&&D.tickFormat(Mc);fa?(D.categories(Sa).tickCentered(dc),ka.categories(Sa).tickCentered(dc)):(D.tickOffset=function(){return 0},ka.tickOffset=function(){return 0});fa&&function(){var a=m,b=y,c=Object.keys(m),g,f;m=function(b){return a(b)+D.tickOffset()};y=function(a){return b(a)+ka.tickOffset()};for(f=0;fa?0:a},R=function(a,b){var c=[],g=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 g[c.indexOf(b)%g.length]}}(Kc,Lc),Ta=d3.select(z.bindto).append("svg").attr("width",t+G+C).attr("height",v+p+T),ob=Ta.append("defs"); -ob.append("clipPath").attr("id",nb).append("rect").attr("y",p).attr("width",t).attr("height",v-p);ob.append("clipPath").attr("id","xaxis-clip").append("rect").attr("x",-1).attr("y",-1).attr("width",t+2).attr("height",40);ob.append("clipPath").attr("id","yaxis-clip").append("rect").attr("x",-G+1).attr("y",p-1).attr("width",G).attr("height",v-p+2);var h=Ta.append("g").attr("transform","translate("+G+","+p+")"),O=null;la&&(O=Ta.append("g").attr("transform","translate("+J+","+pa+")"));var Ca=null;na&& -(Ca=Ta.append("g").attr("transform","translate("+Ea+","+rb+")"));var da=d3.select(z.bindto).style("position","relative").append("div").style("position","absolute").style("width","30%").style("z-index","10").style("visibility","hidden"),ma=d3.svg.brush().x(y).on("brush",function(){I({withTransition:!1,withY:!1,withSubchart:!1})}),fb=d3.behavior.zoom().on("zoom",function(){I({withTransition:!1,withY:!1,withSubchart:!1,withUpdateXDomain:!1})}),Na=null,$a=null,Cb;l.focus=function(a){l.defocus();d3.selectAll(Da(a)).filter(function(a){return Va(a.id)}).classed("focused", -!0).transition().duration(100).style("opacity",1)};l.defocus=function(a){d3.selectAll(Da(a)).filter(function(a){return Va(a.id)}).classed("focused",!1).transition().duration(100).style("opacity",0.3)};l.revert=function(a){d3.selectAll(Da(a)).filter(function(a){return Va(a.id)}).classed("focused",!1).transition().duration(100).style("opacity",1)};l.show=function(a){d3.selectAll(Da(a)).transition().style("opacity",1)};l.hide=function(a){d3.selectAll(Da(a)).transition().style("opacity",0)};l.load=function(a){u(a.done)&& -(a.done=function(){});if("cacheIds"in a&&ga(a.cacheIds))Aa(ha(a.cacheIds),a.done);else if("data"in a)Aa(M(data),a.done);else if("url"in a)d3.csv(a.url,function(b,c){Aa(M(c),a.done)});else if("rows"in a)Aa(M(qa(a.rows)),a.done);else if("columns"in a)Aa(M(ra(a.columns)),a.done);else throw Error("url or rows or columns is required.");};l.unload=function(a){l.data.targets=l.data.targets.filter(function(b){return b.id!=a});d3.selectAll(".target-"+a).transition().style("opacity",0).remove();na&&(d3.selectAll(".legend-item-"+ -a).remove(),Ra(l.data.targets));0",d,c,f;for(d=0;d"+f+""+c+"";return b+""}), +Ec=c(["tooltip","init","show"],!1),oa=c(["tooltip","init","x"],0),$b=c(["tooltip","init","position"],{top:"0px",left:"50px"}),nb=z.bindto.replace("#","")+"-clip",Qa="url(#"+nb+")",H="timeseries"===cc,fa="categorized"===cc,kb=null,Ra=!1,aa=na?40:0,Mc=function(a){return function(b){for(var d=a.length-1,c=a[d];!c[1](b);)c=a[--d];return c[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()}]]),ba=d3.time.format(Jc).parse,sb,xb,ub,wb,yb,t,v,ia,Ab,Bb,Za,$a,m,x,Q,y,Ia,Ja,D=fa?qb():d3.svg.axis(),ja=d3.svg.axis(),Ka=d3.svg.axis(),ka=fa?qb():d3.svg.axis();P();S(); +H&&D.tickFormat(Mc);fa?(D.categories(Ta).tickCentered(dc),ka.categories(Ta).tickCentered(dc)):(D.tickOffset=function(){return 0},ka.tickOffset=function(){return 0});fa&&function(){var a=m,b=y,c=Object.keys(m),g,f;m=function(b){return a(b)+D.tickOffset()};y=function(a){return b(a)+ka.tickOffset()};for(f=0;fa?0:a},R=function(a,b){var c=[],g=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 g[c.indexOf(b)%g.length]}}(Kc,Lc),Ua=d3.select(z.bindto).append("svg").attr("width",t+G+C).attr("height",v+p+T),ob=Ua.append("defs"); +ob.append("clipPath").attr("id",nb).append("rect").attr("y",p).attr("width",t).attr("height",v-p);ob.append("clipPath").attr("id","xaxis-clip").append("rect").attr("x",-1).attr("y",-1).attr("width",t+2).attr("height",40);ob.append("clipPath").attr("id","yaxis-clip").append("rect").attr("x",-G+1).attr("y",p-1).attr("width",G).attr("height",v-p+2);var h=Ua.append("g").attr("transform","translate("+G+","+p+")"),O=null;la&&(O=Ua.append("g").attr("transform","translate("+J+","+pa+")"));var Da=null;na&& +(Da=Ua.append("g").attr("transform","translate("+Fa+","+rb+")"));var da=d3.select(z.bindto).style("position","relative").append("div").style("position","absolute").style("width","30%").style("z-index","10").style("visibility","hidden"),ma=d3.svg.brush().x(y).on("brush",function(){I({withTransition:!1,withY:!1,withSubchart:!1})}),gb=d3.behavior.zoom().on("zoom",function(){I({withTransition:!1,withY:!1,withSubchart:!1,withUpdateXDomain:!1})}),Oa=null,ab=null,Cb;l.focus=function(a){l.defocus();d3.selectAll(Ea(a)).filter(function(a){return Wa(a.id)}).classed("focused", +!0).transition().duration(100).style("opacity",1)};l.defocus=function(a){d3.selectAll(Ea(a)).filter(function(a){return Wa(a.id)}).classed("focused",!1).transition().duration(100).style("opacity",0.3)};l.revert=function(a){d3.selectAll(Ea(a)).filter(function(a){return Wa(a.id)}).classed("focused",!1).transition().duration(100).style("opacity",1)};l.show=function(a){d3.selectAll(Ea(a)).transition().style("opacity",1)};l.hide=function(a){d3.selectAll(Ea(a)).transition().style("opacity",0)};l.load=function(a){u(a.done)&& +(a.done=function(){});if("cacheIds"in a&&ga(a.cacheIds))Ba(ha(a.cacheIds),a.done);else if("data"in a)Ba(M(data),a.done);else if("url"in a)d3.csv(a.url,function(b,c){Ba(M(c),a.done)});else if("rows"in a)Ba(M(qa(a.rows)),a.done);else if("columns"in a)Ba(M(ra(a.columns)),a.done);else throw Error("url or rows or columns is required.");};l.unload=function(a){l.data.targets=l.data.targets.filter(function(b){return b.id!=a});d3.selectAll(".target-"+a).transition().style("opacity",0).remove();na&&(d3.selectAll(".legend-item-"+ +a).remove(),Sa(l.data.targets));0b.classes.indexOf(a)})});return K};l.data.get=function(a){a=l.data.getAsTarget(a);return k(a)?a.values.map(function(a){return a.value}):void 0};l.data.getAsTarget=function(a){var b= -Ka(function(b){return b.id==a});return 0