From f135516889c417118358230d71ef9763415494e8 Mon Sep 17 00:00:00 2001 From: Masayuki Tanaka Date: Fri, 18 Oct 2013 10:17:36 +0900 Subject: [PATCH] Add inner labeled axis --- c3.js | 19 ++++--- c3.min.js | 119 ++++++++++++++++++++++---------------------- htdocs/js/c3.min.js | 116 +++++++++++++++++++++--------------------- 3 files changed, 129 insertions(+), 125 deletions(-) diff --git a/c3.js b/c3.js index 1ddfb41..fcf3887 100644 --- a/c3.js +++ b/c3.js @@ -71,12 +71,14 @@ __axis_y_center = getConfig(['axis','y','center'], null), __axis_y_text = getConfig(['axis','y','text'], null), __axis_y_rescale = getConfig(['axis','y','rescale'], true), + __axis_y_inner = getConfig(['axis','y','inner'], false), __axis_y2_show = getConfig(['axis','y2','show'], false), __axis_y2_max = getConfig(['axis','y2','max'], null), __axis_y2_min = getConfig(['axis','y2','min'], null), __axis_y2_center = getConfig(['axis','y2','center'], null), __axis_y2_text = getConfig(['axis','y2','text'], null), __axis_y2_rescale = getConfig(['axis','y2','rescale'], true), + __axis_y2_inner = getConfig(['axis','y2','inner'], false), __axis_rotated = getConfig(['axis','rotated'], false); // grid @@ -166,13 +168,14 @@ function updateSizes () { bottom = 20 + __subchart_size_height + legendHeight, - right = __axis_y2_show && !__axis_rotated ? 50 : 1, + right = __axis_y2_show && !__axis_rotated && !__axis_y2_inner ? 50 : 1, + left = __axis_y_inner ? 0 : 40, top2 = __size_height - __subchart_size_height - legendHeight, bottom2 = 20 + legendHeight, top3 = __size_height - legendHeight, - margin = {top: 0, right: right, bottom: bottom, left: 40}, - margin2 = {top: top2, right: 20, bottom: bottom2, left: 40}, - margin3 = {top: top3, right: 20, bottom: 0, left: 40}, + margin = {top: 0, right: right, bottom: bottom, left: left}, + margin2 = {top: top2, right: 20, bottom: bottom2, left: left}, + margin3 = {top: top3, right: 20, bottom: 0, left: left}, width = (__size_width == null ? getParentWidth() : __size_width) - margin.left - margin.right, height = __size_height - margin.top - margin.bottom, height2 = __size_height - margin2.top - margin2.bottom, @@ -200,8 +203,8 @@ subY2 = getY(height2, 10); // update axies xAxis.scale(x).orient(__axis_rotated ? "left" : "bottom"); - yAxis.scale(y).orient(__axis_rotated ? "bottom" : "left"); - yAxis2.scale(y2).orient(__axis_rotated ? "top" : "right"); + yAxis.scale(y).orient(__axis_rotated ? (__axis_y_inner ? "top" : "bottom") : (__axis_y_inner ? "right" : "left")); + yAxis2.scale(y2).orient(__axis_rotated ? (__axis_y2_inner ? "bottom" : "top") : (__axis_y2_inner ? "left" : "right")); subXAxis.scale(subX).orient("bottom"); }; updateScales(); @@ -317,9 +320,9 @@ defs.append("clipPath") .attr("id", "yaxis-clip") .append("rect") - .attr("x", -40 + 1) + .attr("x", -margin.left + 1) .attr("y", margin.top - 1) - .attr("width", 40) + .attr("width", margin.left) .attr("height", height - margin.top + 2); // Define regions diff --git a/c3.min.js b/c3.min.js index 1bc8df4..b72788b 100644 --- a/c3.min.js +++ b/c3.min.js @@ -1,59 +1,60 @@ -(function(kb){function lb(){function m(c,l){c.attr("transform",function(c){return"translate("+(l(c)+R)+",0)"})}function u(c,l){c.attr("transform",function(c){return"translate(0,"+l(c)+")"})}function Ca(c){var l=c[0];c=c[c.length-1];return lv[d].indexOf(k.id)))for(e=0;e=s;s+= -diffx2)n+=e(a[c-1],a[c],s,l);return n}function ab(a){var b=h.data.targets=K(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);g.append("g").attr("class","x axis").attr("clip-path",f?"":"url(#xaxis-clip)").attr("transform","translate(0,"+w+")").call(f?ra:E);g.append("g").attr("class","y axis").attr("clip-path",f?"url(#yaxis-clip)":"").call(f?E:ra).append("text").attr("transform", -"rotate(-90)").attr("dy","1.4em").attr("dx","-.8em").style("text-anchor","end").text(pc);qb&&g.append("g").attr("class","y2 axis").attr("transform","translate("+(f?0:q)+","+(f?10:0)+")").call(Va);d=g.append("g").attr("clip-path",Na).attr("class","grid");Mb&&d.append("g").attr("class","xgrids");bb&&(c=d.append("g").attr("class","xgrid-lines").selectAll(".xgrid-line").data(bb).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}));qc&&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);Nb&&d.append("g").attr("class","ygrids");cb&&d.append("g").attr("class","ygrid-lines").selectAll("ygrid-line").data(cb).enter().append("line").attr("class",function(a){return"ygrid-line "+ -a["class"]});g.append("g").attr("clip-path",Na).attr("class","regions");g.append("g").attr("clip-path",Na).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(!Oa){var d=h.data.targets.map(function(a){return Ea(a.values[b])}),c,e;if(0",c,e,f;for(c=0;c"+f+""+e+"";return b+""}),sc=c(["tooltip","init","show"],!1),ka=c(["tooltip","init","x"],0),Sb=c(["tooltip","init","position"],{top:"0px",left:"50px"}),ib=z.bindto.replace("#","")+"-clip",Na="url(#"+ib+")",G="timeseries"===Vb,Ba="categorized"===Vb,eb=null,Oa=!1,$=ja?40:0,Ac=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(xc).parse,nb,sb,pb,rb,tb,q,w,fa,vb,wb,Ta,Ua,p,x,P,y,Ga,Ha,E=Ba?lb(): -d3.svg.axis(),ra=d3.svg.axis(),Va=d3.svg.axis(),ga=Ba?lb():d3.svg.axis();O();R();G&&E.tickFormat(Ac);Ba?(E.categories(Qa).tickCentered(Wb),ga.categories(Qa).tickCentered(Wb)):(E.tickOffset=function(){return 0},ga.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)+ga.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]}}(yc,zc),Ra=d3.select(z.bindto).append("svg").attr("width", -q+L+D).attr("height",w+t+T),jb=Ra.append("defs");jb.append("clipPath").attr("id",ib).append("rect").attr("y",t).attr("width",q).attr("height",w-t);jb.append("clipPath").attr("id","xaxis-clip").append("rect").attr("x",-1).attr("y",-1).attr("width",q+2).attr("height",40);jb.append("clipPath").attr("id","yaxis-clip").append("rect").attr("x",-39).attr("y",t-1).attr("width",40).attr("height",w-t+2);var g=Ra.append("g").attr("transform","translate("+L+","+t+")"),N=null;wa&&(N=Ra.append("g").attr("transform", -"translate("+H+","+la+")"));var za=null;ja&&(za=Ra.append("g").attr("transform","translate("+Ca+","+mb+")"));var ia=d3.select(z.bindto).style("position","relative").append("div").style("position","absolute").style("width","30%").style("z-index","10").style("visibility","hidden"),ha=d3.svg.brush().x(y).on("brush",function(){I({withTransition:!1,withY:!1,withSubchart:!1})}),La=null,Wa=null;h.focus=function(a){h.defocus();d3.selectAll(Aa(a)).filter(function(a){return Sa(a.id)}).classed("focused",!0).transition().duration(100).style("opacity", -1)};h.defocus=function(a){d3.selectAll(Aa(a)).filter(function(a){return Sa(a.id)}).classed("focused",!1).transition().duration(100).style("opacity",0.3)};h.revert=function(a){d3.selectAll(Aa(a)).filter(function(a){return Sa(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(K(data),a.done);else if("url"in a)d3.csv(a.url,function(b,c){xa(K(c),a.done)});else if("rows"in a)xa(K(ma(a.rows)),a.done);else if("columns"in a)xa(K(na(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();ja&&(d3.selectAll(".legend-item-"+a).remove(),Pa(h.data.targets)); -0b.classes.indexOf(a)})});return J};h.data.get=function(a){a=h.data.getAsTarget(a);return m(a)?a.values.map(function(a){return a.value}):void 0};h.data.getAsTarget=function(a){var b=Ia(function(b){return b.id== -a});return 0v[d].indexOf(k.id)))for(e=0;e=s;s+=diffx2)n+=e(a[c-1],a[c],s,l);return n}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);g.append("g").attr("class","x axis").attr("clip-path",f?"":"url(#xaxis-clip)").attr("transform","translate(0,"+w+")").call(f?ra:E);g.append("g").attr("class","y axis").attr("clip-path",f?"url(#yaxis-clip)": +"").call(f?E:ra).append("text").attr("transform","rotate(-90)").attr("dy","1.4em").attr("dx","-.8em").style("text-anchor","end").text(rc);sb&&g.append("g").attr("class","y2 axis").attr("transform","translate("+(f?0:q)+","+(f?10:0)+")").call(Xa);d=g.append("g").attr("clip-path",Na).attr("class","grid");Ob&&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}));sc&&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);Pb&&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",Na).attr("class","regions");g.append("g").attr("clip-path",Na).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(!Oa){var d=h.data.targets.map(function(a){return Ea(a.values[b])}), +c,e;if(0",c,e,f;for(c=0;c"+f+""+e+"";return b+""}),uc=c(["tooltip","init","show"],!1),ka=c(["tooltip","init","x"],0),Ub=c(["tooltip","init","position"],{top:"0px",left:"50px"}),kb=z.bindto.replace("#","")+"-clip",Na="url(#"+kb+")",H="timeseries"===Xb,Ba="categorized"=== +Xb,gb=null,Oa=!1,$=ja?40:0,Cc=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(zc).parse,pb,ub,rb,tb,vb,q,w,fa,xb,yb,Va,Wa,p,x,P,y,Ga,Ha,E=Ba?nb():d3.svg.axis(),ra=d3.svg.axis(),Xa=d3.svg.axis(),ga=Ba?nb():d3.svg.axis();O();R();H&&E.tickFormat(Cc);Ba?(E.categories(Qa).tickCentered(Yb),ga.categories(Qa).tickCentered(Yb)):(E.tickOffset=function(){return 0},ga.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)+ga.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]}}(Ac,Bc),Ra=d3.select(z.bindto).append("svg").attr("width",q+G+D).attr("height",w+t+T),lb=Ra.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=Ra.append("g").attr("transform","translate("+G+","+t+")"),N=null;wa&&(N=Ra.append("g").attr("transform","translate("+I+","+la+")"));var za=null;ja&&(za=Ra.append("g").attr("transform","translate("+Ca+","+ob+")"));var ia=d3.select(z.bindto).style("position","relative").append("div").style("position","absolute").style("width","30%").style("z-index", +"10").style("visibility","hidden"),ha=d3.svg.brush().x(y).on("brush",function(){J({withTransition:!1,withY:!1,withSubchart:!1})}),La=null,Ya=null;h.focus=function(a){h.defocus();d3.selectAll(Aa(a)).filter(function(a){return Sa(a.id)}).classed("focused",!0).transition().duration(100).style("opacity",1)};h.defocus=function(a){d3.selectAll(Aa(a)).filter(function(a){return Sa(a.id)}).classed("focused",!1).transition().duration(100).style("opacity",0.3)};h.revert=function(a){d3.selectAll(Aa(a)).filter(function(a){return Sa(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(ma(a.rows)),a.done);else if("columns"in a)xa(L(na(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();ja&&(d3.selectAll(".legend-item-"+a).remove(),Pa(h.data.targets));0b.classes.indexOf(a)})});return K};h.data.get=function(a){a=h.data.getAsTarget(a);return m(a)?a.values.map(function(a){return a.value}):void 0};h.data.getAsTarget=function(a){var b=Ia(function(b){return b.id==a});return 0v[d].indexOf(k.id)))for(e=0;e=s;s+= -diffx2)n+=e(a[c-1],a[c],s,l);return n}function ab(a){var b=h.data.targets=K(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);d=g.append("g").attr("clip-path",Na).attr("class","grid");Mb&&d.append("g").attr("class","xgrids");bb&&(c=d.append("g").attr("class","xgrid-lines").selectAll(".xgrid-line").data(bb).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}));pc&&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);Nb&&d.append("g").attr("class","ygrids");cb&&d.append("g").attr("class","ygrid-lines").selectAll("ygrid-line").data(cb).enter().append("line").attr("class", +(function(mb){function nb(){function m(c,l){c.attr("transform",function(c){return"translate("+(l(c)+R)+",0)"})}function u(c,l){c.attr("transform",function(c){return"translate(0,"+l(c)+")"})}function Ca(c){var l=c[0];c=c[c.length-1];return lv[d].indexOf(k.id)))for(e=0;e=s;s+=diffx2)n+=e(a[c-1],a[c],s,l);return n}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);g.append("g").attr("class","x axis").attr("clip-path",f?"":"url(#xaxis-clip)").attr("transform","translate(0,"+w+")").call(f?ra:E);g.append("g").attr("class","y axis").attr("clip-path",f?"url(#yaxis-clip)": +"").call(f?E:ra).append("text").attr("transform","rotate(-90)").attr("dy","1.4em").attr("dx","-.8em").style("text-anchor","end").text(rc);sb&&g.append("g").attr("class","y2 axis").attr("transform","translate("+(f?0:q)+","+(f?10:0)+")").call(Xa);d=g.append("g").attr("clip-path",Na).attr("class","grid");Ob&&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}));sc&&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);Pb&&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",Na).attr("class","regions");g.append("g").attr("clip-path",Na).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(!Oa){var d=h.data.targets.map(function(a){return Ea(a.values[b])}), -c,e;if(0",c,e,f;for(c=0;c"+f+""+e+"";return b+""}),sc=c(["tooltip","init","show"],!1),ka=c(["tooltip","init","x"],0),Sb=c(["tooltip","init","position"],{top:"0px",left:"50px"}),ib=z.bindto.replace("#","")+"-clip",Na="url(#"+ib+")",G="timeseries"===Vb,Ba="categorized"===Vb,eb=null,Oa=!1,$=ja?40:0,Ac=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(xc).parse,nb,sb,pb,rb,tb,q,w,fa,vb,wb,Ta,Ua,p,x,P,y,Ga,Ha,E=Ba?lb():d3.svg.axis(),ra=d3.svg.axis(),Va=d3.svg.axis(),ga=Ba?lb():d3.svg.axis();O();R();G&&E.tickFormat(Ac);Ba?(E.categories(Qa).tickCentered(Wb),ga.categories(Qa).tickCentered(Wb)):(E.tickOffset=function(){return 0},ga.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)+ga.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]}}(yc,zc),Ra=d3.select(z.bindto).append("svg").attr("width",q+L+D).attr("height",w+t+T),jb=Ra.append("defs");jb.append("clipPath").attr("id",ib).append("rect").attr("y",t).attr("width",q).attr("height",w-t);jb.append("clipPath").attr("id","xaxis-clip").append("rect").attr("x",-1).attr("y",-1).attr("width",q+2).attr("height",40);jb.append("clipPath").attr("id","yaxis-clip").append("rect").attr("x",-39).attr("y", -t-1).attr("width",40).attr("height",w-t+2);var g=Ra.append("g").attr("transform","translate("+L+","+t+")"),N=null;wa&&(N=Ra.append("g").attr("transform","translate("+H+","+la+")"));var za=null;ja&&(za=Ra.append("g").attr("transform","translate("+Ca+","+mb+")"));var ia=d3.select(z.bindto).style("position","relative").append("div").style("position","absolute").style("width","30%").style("z-index","10").style("visibility","hidden"),ha=d3.svg.brush().x(y).on("brush",function(){I({withTransition:!1,withY:!1, -withSubchart:!1})}),La=null,Wa=null;h.focus=function(a){h.defocus();d3.selectAll(Aa(a)).filter(function(a){return Sa(a.id)}).classed("focused",!0).transition().duration(100).style("opacity",1)};h.defocus=function(a){d3.selectAll(Aa(a)).filter(function(a){return Sa(a.id)}).classed("focused",!1).transition().duration(100).style("opacity",0.3)};h.revert=function(a){d3.selectAll(Aa(a)).filter(function(a){return Sa(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(K(data),a.done);else if("url"in a)d3.csv(a.url,function(b,c){xa(K(c),a.done)});else if("rows"in a)xa(K(ma(a.rows)),a.done);else if("columns"in a)xa(K(na(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();ja&&(d3.selectAll(".legend-item-"+a).remove(),Pa(h.data.targets));0b.classes.indexOf(a)})});return J};h.data.get=function(a){a= -h.data.getAsTarget(a);return m(a)?a.values.map(function(a){return a.value}):void 0};h.data.getAsTarget=function(a){var b=Ia(function(b){return b.id==a});return 0",c,e,f;for(c=0;c"+f+""+e+"";return b+""}),uc=c(["tooltip","init","show"],!1),ka=c(["tooltip","init","x"],0),Ub=c(["tooltip","init","position"],{top:"0px",left:"50px"}),kb=z.bindto.replace("#","")+"-clip",Na="url(#"+kb+")",H="timeseries"===Xb,Ba="categorized"=== +Xb,gb=null,Oa=!1,$=ja?40:0,Cc=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(zc).parse,pb,ub,rb,tb,vb,q,w,fa,xb,yb,Va,Wa,p,x,P,y,Ga,Ha,E=Ba?nb():d3.svg.axis(),ra=d3.svg.axis(),Xa=d3.svg.axis(),ga=Ba?nb():d3.svg.axis();O();R();H&&E.tickFormat(Cc);Ba?(E.categories(Qa).tickCentered(Yb),ga.categories(Qa).tickCentered(Yb)):(E.tickOffset=function(){return 0},ga.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)+ga.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]}}(Ac,Bc),Ra=d3.select(z.bindto).append("svg").attr("width",q+G+D).attr("height",w+t+T),lb=Ra.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=Ra.append("g").attr("transform","translate("+G+","+t+")"),N=null;wa&&(N=Ra.append("g").attr("transform","translate("+I+","+la+")"));var za=null;ja&&(za=Ra.append("g").attr("transform","translate("+Ca+","+ob+")"));var ia=d3.select(z.bindto).style("position","relative").append("div").style("position","absolute").style("width","30%").style("z-index", +"10").style("visibility","hidden"),ha=d3.svg.brush().x(y).on("brush",function(){J({withTransition:!1,withY:!1,withSubchart:!1})}),La=null,Ya=null;h.focus=function(a){h.defocus();d3.selectAll(Aa(a)).filter(function(a){return Sa(a.id)}).classed("focused",!0).transition().duration(100).style("opacity",1)};h.defocus=function(a){d3.selectAll(Aa(a)).filter(function(a){return Sa(a.id)}).classed("focused",!1).transition().duration(100).style("opacity",0.3)};h.revert=function(a){d3.selectAll(Aa(a)).filter(function(a){return Sa(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(ma(a.rows)),a.done);else if("columns"in a)xa(L(na(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();ja&&(d3.selectAll(".legend-item-"+a).remove(),Pa(h.data.targets));0b.classes.indexOf(a)})});return K};h.data.get=function(a){a=h.data.getAsTarget(a);return m(a)?a.values.map(function(a){return a.value}):void 0};h.data.getAsTarget=function(a){var b=Ia(function(b){return b.id==a});return 0