From 94255f82232741560f8c49f7b40d3f9c3e04ee78 Mon Sep 17 00:00:00 2001 From: Masayuki Tanaka Date: Fri, 18 Oct 2013 12:50:17 +0900 Subject: [PATCH] Enable bar chart with normal axis --- c3.js | 8 ++- c3.min.js | 118 ++++++++++++++++++++++---------------------- htdocs/js/c3.min.js | 118 ++++++++++++++++++++++---------------------- 3 files changed, 125 insertions(+), 119 deletions(-) diff --git a/c3.js b/c3.js index 5b42e62..c182e5b 100644 --- a/c3.js +++ b/c3.js @@ -621,7 +621,13 @@ }; } function getBarW (axis, barTargetsNum) { - return (axis.tickOffset()*2*0.6) / barTargetsNum; + var barW; + if (isCategorized) { + barW = (axis.tickOffset()*2*0.6) / barTargetsNum; + } else { + barW = (((__axis_rotated ? height : width)*getXDomainRatio())/(maxDataCount()-1))*0.6; + } + return barW; } function getBarH (height, isSub) { var h = height === null ? function(v){ return v; } : function(v){ return height-v; }; diff --git a/c3.min.js b/c3.min.js index 12d6b45..f2f65c9 100644 --- a/c3.min.js +++ b/c3.min.js @@ -1,61 +1,61 @@ -(function(ob){function pb(){function h(c,Ua){c.attr("transform",function(c){return"translate("+(Ua(c)+R)+",0)"})}function t(c,h){c.attr("transform",function(c){return"translate(0,"+h(c)+")"})}function Ea(c){var h=c[0];c=c[c.length-1];return hu[d].indexOf(c.id)))for(e=0;ev[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", +d}).attr("cx",f?V:U).attr("cy",f?U:V).attr("stroke",function(){return R(b.id)}).attr("r",1.4*ya).transition().duration(100).attr("r",ya)}function db(a,b,d){qc(a,b);g.select(".selected-circles-"+b.id).selectAll(".selected-circle-"+d).transition().duration(100).attr("r",0).remove()}function Nb(a,b,d,e){a?Mb(b,d,e):db(b,d,e)}function rc(a,b,d){}function Ob(a,b,d){}function Pb(a,b,d,e){}function sc(a,b,d,e){var c,s,m="M",g,k,l,n,r,p=[];if(h(e))for(c=0;c=s;s+=diffx2)m+=e(a[c-1],a[c],s,l);return m}function eb(a){var b=k.data.targets=M(a),d,c;l.domain(d3.extent(a.map(function(a){return a.x})));x.domain(E(b,"y"));Q.domain(E(b,"y2"));y.domain(l.domain());Ha.domain(x.domain());Ia.domain(Q.domain());D.ticks(10>a.length?a.length:10);ia.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,"+u+")").call(f?ia:D);g.append("g").attr("class","y axis").attr("clip-path",f?"url(#yaxis-clip)":"").call(f?D:ia).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"}),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,rb,wb,tb,vb,xb,p,w,fa,zb,Ab,Ya,Za,l,x,P,y,Ha,Ia,D=Da?pb():d3.svg.axis(),ga=d3.svg.axis(),Ja=d3.svg.axis(),ha=Da?pb():d3.svg.axis();O();R();H&&D.tickFormat(Gc);Da?(D.categories(Sa).tickCentered($b),ha.categories(Sa).tickCentered($b)):(D.tickOffset=function(){return 0},ha.tickOffset=function(){return 0});Da&&function(){var a=l,b=y,c=Object.keys(l),e,f;l=function(b){return a(b)+D.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),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",c,e,f;for(c=0;c"+f+""+e+"";return b+""}),yc=c(["tooltip","init","show"],!1),na=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,ea="categorized"===Zb,ib=null,Qa=!1,aa=ma?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()}]]),ba=d3.time.format(Dc).parse,rb,wb,tb,vb,xb,p,u,ha,zb,Ab,Ya,Za,l,x,Q,y,Ha,Ia,D=ea?pb():d3.svg.axis(),ia=d3.svg.axis(),Ja=d3.svg.axis(),ja=ea?pb():d3.svg.axis();P();S();H&&D.tickFormat(Gc);ea?(D.categories(Sa).tickCentered($b),ja.categories(Sa).tickCentered($b)):(D.tickOffset=function(){return 0},ja.tickOffset=function(){return 0});ea&&function(){var a= +l,b=y,c=Object.keys(l),e,f;l=function(b){return a(b)+D.tickOffset()};y=function(a){return b(a)+ja.tickOffset()};for(f=0;fa?0: +a},R=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",u+r+T),nb=Ta.append("defs");nb.append("clipPath").attr("id",mb).append("rect").attr("y",r).attr("width",p).attr("height",u-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",u-r+2);var g=Ta.append("g").attr("transform","translate("+G+","+r+")"),O=null;za&&(O=Ta.append("g").attr("transform","translate("+I+","+oa+")"));var Ca=null;ma&&(Ca=Ta.append("g").attr("transform","translate("+Ea+","+qb+")"));var la=d3.select(z.bindto).style("position","relative").append("div").style("position","absolute").style("width", +"30%").style("z-index","10").style("visibility","hidden"),ka=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(Da(a)).filter(function(a){return Va(a.id)}).classed("focused",!0).transition().duration(100).style("opacity",1)};k.defocus=function(a){d3.selectAll(Da(a)).filter(function(a){return Va(a.id)}).classed("focused",!1).transition().duration(100).style("opacity",0.3)};k.revert=function(a){d3.selectAll(Da(a)).filter(function(a){return Va(a.id)}).classed("focused", +!1).transition().duration(100).style("opacity",1)};k.show=function(a){d3.selectAll(Da(a)).transition().style("opacity",1)};k.hide=function(a){d3.selectAll(Da(a)).transition().style("opacity",0)};k.load=function(a){t(a.done)&&(a.done=function(){});if("cacheIds"in a&&fa(a.cacheIds))Aa(ga(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(pa(a.rows)),a.done);else if("columns"in a)Aa(M(qa(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();ma&&(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 0u[d].indexOf(c.id)))for(e=0;ev[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", +d}).attr("cx",f?V:U).attr("cy",f?U:V).attr("stroke",function(){return R(b.id)}).attr("r",1.4*ya).transition().duration(100).attr("r",ya)}function db(a,b,d){qc(a,b);g.select(".selected-circles-"+b.id).selectAll(".selected-circle-"+d).transition().duration(100).attr("r",0).remove()}function Nb(a,b,d,e){a?Mb(b,d,e):db(b,d,e)}function rc(a,b,d){}function Ob(a,b,d){}function Pb(a,b,d,e){}function sc(a,b,d,e){var c,s,m="M",g,k,l,n,r,p=[];if(h(e))for(c=0;c=s;s+=diffx2)m+=e(a[c-1],a[c],s,l);return m}function eb(a){var b=k.data.targets=M(a),d,c;l.domain(d3.extent(a.map(function(a){return a.x})));x.domain(E(b,"y"));Q.domain(E(b,"y2"));y.domain(l.domain());Ha.domain(x.domain());Ia.domain(Q.domain());D.ticks(10>a.length?a.length:10);ia.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,"+u+")").call(f?ia:D);g.append("g").attr("class","y axis").attr("clip-path",f?"url(#yaxis-clip)":"").call(f?D:ia).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"}),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,rb,wb,tb,vb,xb,p,w,fa,zb,Ab,Ya,Za,l,x,P,y,Ha,Ia,D=Da?pb():d3.svg.axis(),ga=d3.svg.axis(),Ja=d3.svg.axis(),ha=Da?pb():d3.svg.axis();O();R();H&&D.tickFormat(Gc);Da?(D.categories(Sa).tickCentered($b),ha.categories(Sa).tickCentered($b)):(D.tickOffset=function(){return 0},ha.tickOffset=function(){return 0});Da&&function(){var a=l,b=y,c=Object.keys(l),e,f;l=function(b){return a(b)+D.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),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",c,e,f;for(c=0;c"+f+""+e+"";return b+""}),yc=c(["tooltip","init","show"],!1),na=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,ea="categorized"===Zb,ib=null,Qa=!1,aa=ma?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()}]]),ba=d3.time.format(Dc).parse,rb,wb,tb,vb,xb,p,u,ha,zb,Ab,Ya,Za,l,x,Q,y,Ha,Ia,D=ea?pb():d3.svg.axis(),ia=d3.svg.axis(),Ja=d3.svg.axis(),ja=ea?pb():d3.svg.axis();P();S();H&&D.tickFormat(Gc);ea?(D.categories(Sa).tickCentered($b),ja.categories(Sa).tickCentered($b)):(D.tickOffset=function(){return 0},ja.tickOffset=function(){return 0});ea&&function(){var a= +l,b=y,c=Object.keys(l),e,f;l=function(b){return a(b)+D.tickOffset()};y=function(a){return b(a)+ja.tickOffset()};for(f=0;fa?0: +a},R=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",u+r+T),nb=Ta.append("defs");nb.append("clipPath").attr("id",mb).append("rect").attr("y",r).attr("width",p).attr("height",u-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",u-r+2);var g=Ta.append("g").attr("transform","translate("+G+","+r+")"),O=null;za&&(O=Ta.append("g").attr("transform","translate("+I+","+oa+")"));var Ca=null;ma&&(Ca=Ta.append("g").attr("transform","translate("+Ea+","+qb+")"));var la=d3.select(z.bindto).style("position","relative").append("div").style("position","absolute").style("width", +"30%").style("z-index","10").style("visibility","hidden"),ka=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(Da(a)).filter(function(a){return Va(a.id)}).classed("focused",!0).transition().duration(100).style("opacity",1)};k.defocus=function(a){d3.selectAll(Da(a)).filter(function(a){return Va(a.id)}).classed("focused",!1).transition().duration(100).style("opacity",0.3)};k.revert=function(a){d3.selectAll(Da(a)).filter(function(a){return Va(a.id)}).classed("focused", +!1).transition().duration(100).style("opacity",1)};k.show=function(a){d3.selectAll(Da(a)).transition().style("opacity",1)};k.hide=function(a){d3.selectAll(Da(a)).transition().style("opacity",0)};k.load=function(a){t(a.done)&&(a.done=function(){});if("cacheIds"in a&&fa(a.cacheIds))Aa(ga(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(pa(a.rows)),a.done);else if("columns"in a)Aa(M(qa(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();ma&&(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