Browse Source

Add zoom.privileged option

pull/1/head
Masayuki Tanaka 11 years ago
parent
commit
5ad04957a2
  1. 24
      c3.js
  2. 72
      c3.min.js

24
c3.js

@ -34,7 +34,8 @@
__size_height = getConfig(['size','height'], null);
var __zoom_enabled = getConfig(['zoom','enabled'], false),
__zoom_extent = getConfig(['zoom','extent'], null);
__zoom_extent = getConfig(['zoom','extent'], null),
__zoom_privileged = getConfig(['zoom','privileged'], false);
// data - data configuration
checkConfig('data', 'data is required in config');
@ -924,16 +925,6 @@
.call(yAxis2);
}
if (__zoom_enabled) {
main.append('rect')
.attr('class', 'zoom-rect')
.attr('width', width)
.attr('height', height)
.style('opacity', 0)
.style('cursor', 'ew-resize')
.call(zoom).on("dblclick.zoom", null);
}
// Grids
grid = main.append('g')
.attr("clip-path", clipPath)
@ -1193,6 +1184,17 @@
main.select(".chart").append("g")
.attr("class", "chart-lines");
if (__zoom_enabled) {
// if zoom privileged, insert rect to forefront
main.insert('rect', __zoom_privileged ? null : 'g.grid')
.attr('class', 'zoom-rect')
.attr('width', width)
.attr('height', height)
.style('opacity', 0)
.style('cursor', 'ew-resize')
.call(zoom).on("dblclick.zoom", null);
}
// 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)));

72
c3.min.js vendored

@ -20,46 +20,46 @@ d,b)}function Gc(a,c,d){}function Yb(a,c,d){}function Zb(a,c,d,b){}function Hc(a
a*f))+" "+d(m(f))+" "+c(b)+" "+d(m(f+e))}:function(a,b,f,e){return"M"+c(k(f))+" "+d(m(f))+" "+c(k(f+e))+" "+d(m(f+e))};for(f=0;f<a.length;f++)if(u(s)||!Dc(a[f].x,s))p+=" "+r(a[f])+" "+t(a[f]);else for(k=L(a[f-1].x,a[f].x),m=y(a[f-1].value,a[f].value),g=c(a[f].x)-c(a[f-1].x),h=d(a[f].value)-d(a[f-1].value),g=Math.sqrt(Math.pow(g,2)+Math.pow(h,2)),h=2/g,diffx2=2*h,g=h;1>=g;g+=diffx2)p+=b(a[f-1],a[f],g,h);return p}function ob(a){var c=k.data.targets=da(a),d,b;N();S();m.domain(d3.extent(a.map(function(a){return a.x})));
x.domain(B(c,"y"));O.domain(B(c,"y2"));V.domain(m.domain());Qa.domain(x.domain());Ra.domain(O.domain());M.ticks(10>a.length?a.length:10);ga.ticks(Ic).outerTickSize(0).tickFormat(Jc);Sa.ticks(Kc).outerTickSize(0).tickFormat(Lc);P=m.domain();E.x(V);ja&&F.x(m);Ha=d3.select(ya).append("svg").attr("width",t+H+C).attr("height",s+v+U);Ya=Ha.append("defs");Ya.append("clipPath").attr("id",pb).append("rect").attr("y",v).attr("width",t).attr("height",s-v);Ya.append("clipPath").attr("id","xaxis-clip").append("rect").attr("x",
-1).attr("y",-1).attr("width",t+2).attr("height",40);Ya.append("clipPath").attr("id","yaxis-clip").append("rect").attr("x",-H+1).attr("y",v-1).attr("width",H).attr("height",s-v+2);g=Ha.append("g").attr("transform",I.main);w=qa?Ha.append("g").attr("transform",I.context):null;ra=sa?Ha.append("g").attr("transform",I.legend):null;Z=d3.select(ya).style("position","relative").append("div").style("position","absolute").style("width","30%").style("z-index","10").style("visibility","hidden");g.append("g").attr("class",
"x axis").attr("clip-path",e?"":"url(#xaxis-clip)").attr("transform",I.x).call(e?ga:M);g.append("g").attr("class","y axis").attr("clip-path",e?"url(#yaxis-clip)":"").call(e?M:ga).append("text").attr("transform","rotate(-90)").attr("dy","1.4em").attr("dx","-.8em").style("text-anchor","end").text(Mc);Fb&&g.append("g").attr("class","y2 axis").attr("transform",I.y2).call(Sa);if(ja)g.append("rect").attr("class","zoom-rect").attr("width",t).attr("height",s).style("opacity",0).style("cursor","ew-resize").call(F).on("dblclick.zoom",
null);d=g.append("g").attr("clip-path",Ia).attr("class","grid");$b&&d.append("g").attr("class","xgrids");qb&&(b=d.append("g").attr("class","xgrid-lines").selectAll(".xgrid-line").data(qb).enter().append("g").attr("class","xgrid-line"),b.append("line").attr("class",function(a){return""+a["class"]}),b.append("text").attr("class",function(a){return""+a["class"]}).attr("text-anchor","end").attr("transform",e?"":"rotate(-90)").attr("dx",e?0:-v).attr("dy",-6).text(function(a){return a.text}));Nc&&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:v).attr("y2",e?-10:s);ac&&d.append("g").attr("class","ygrids");rb&&d.append("g").attr("class","ygrid-lines").selectAll("ygrid-line").data(rb).enter().append("line").attr("class",function(a){return"ygrid-line "+a["class"]});g.append("g").attr("clip-path",Ia).attr("class","regions");g.append("g").attr("clip-path",Ia).attr("class","chart");g.select(".chart").append("g").attr("class","event-rects").style("fill-opacity",
0).style("cursor",ja?"ew-resize":null).selectAll(".event-rects").data(a).enter().append("rect").attr("class",function(a,c){return"event-rect event-rect-"+c}).style("cursor",$&&ka?"pointer":null).on("mouseover",function(a,c){if(!Za){var d=k.data.targets.map(function(a){return ca(a.values[c])}),b,n;if(0<Object.keys(Da).length){n=[];for(var h in Da)for(b=0;b<d.length;b++)if(d[b].id===h){n.push(d[b]);d.shift(b);break}d=n.concat(d)}bc&&g.selectAll(".-circle-"+c).classed(aa,!0).attr("r",cc);g.selectAll(".-bar-"+
c).classed(aa,!0);g.selectAll("line.xgrid-focus").style("visibility","visible").data([d[0]]).attr(e?"y1":"x1",Xa).attr(e?"y2":"x2",Xa);Z.style("top",d3.mouse(this)[1]+30+"px").style("left",(e?d3.mouse(this)[0]:m(d[0].x))+60+"px");Z.html(dc(d));Z.style("visibility","visible")}}).on("mouseout",function(a,c){g.select("line.xgrid-focus").style("visibility","hidden");Z.style("visibility","hidden");g.selectAll(".-circle-"+c).filter(function(){return d3.select(this).classed(aa)}).classed(aa,!1).attr("r",
sb);g.selectAll(".-bar-"+c).classed(aa,!1)}).on("mousemove",function(a,c){$&&!Za&&(ka||g.selectAll(".-shape-"+c).filter(function(a){return la(a)}).each(function(a){a=d3.select(this).classed(aa,!0);"circle"===this.nodeName&&a.attr("r",cc);d3.select(".event-rect-"+c).style("cursor",null)}).filter(function(a){a=d3.select(this);if("circle"===this.nodeName)return Ub(this,Ga);if("rect"===this.nodeName)return Vb(this,a.attr("x"),a.attr("y"))}).each(function(a){a=d3.select(this);a.classed(aa)||(a.classed(aa,
!0),"circle"===this.nodeName&&a.attr("r",Ga));d3.select(".event-rect-"+c).style("cursor","pointer")}))}).on("click",function(a,c){tb?tb=!1:g.selectAll(".-shape-"+c).each(function(a){var d=d3.select(this),b=d.classed(ba),f=!1,e;"circle"===this.nodeName?(f=Ub(this,1.5*Ga),e=Xb):"rect"===this.nodeName&&(f=Vb(this),e=Zb);if(ka||f)$&&la(a)&&(d.classed(ba,!b),e(!b,d,a,c)),Oc(a,d)})}).call(d3.behavior.drag().origin(Object).on("drag",function(a){if($&&(!ja||F.altDomain)){a=ub[0];var c=ub[1],d=d3.mouse(this),
b=d[0],d=d[1],e=Math.min(a,b),n=Math.max(a,b),k=ka?v:Math.min(c,d),h=ka?s:Math.max(c,d);g.select(".dragarea").attr("x",e).attr("y",k).attr("width",n-e).attr("height",h-k);g.selectAll(".-shapes").selectAll(".-shape").filter(function(a){return la(a)}).each(function(a,c){var d=d3.select(this),b=d.classed(ba),f=d.classed(vb),g,p,m,l;g=!1;"circle"===this.nodeName?(g=1*d.attr("cx"),p=1*d.attr("cy"),l=Xb,g=e<g&&g<n&&k<p&&p<h):"rect"===this.nodeName&&(g=1*d.attr("x"),p=1*d.attr("y"),m=1*d.attr("width"),l=
Zb,g=e<g+m&&g<n&&p<h);g^f&&(d.classed(vb,!f),d.classed(ba,!b),l(!b,d,a,c))})}}).on("dragstart",function(){$&&(ub=d3.mouse(this),g.select(".chart").append("rect").attr("class","dragarea").style("opacity",0.1),Za=!0)}).on("dragend",function(){$&&(g.select(".dragarea").transition().duration(100).style("opacity",0).remove(),g.selectAll(".-shape").classed(vb,!1),Za=!1)})).call(F).on("dblclick.zoom",null);g.select(".chart").append("g").attr("class","chart-bars");g.select(".chart").append("g").attr("class",
"chart-lines");null!==Ja&&E.extent("function"!==typeof Ja?Ja:D?Ja(Wa,hb):Ja(0,Ea()-1));qa&&(w.append("g").attr("clip-path",Ia).attr("class","chart"),w.select(".chart").append("g").attr("class","chart-bars"),w.select(".chart").append("g").attr("class","chart-lines"),w.append("g").attr("clip-path",Ia).attr("class","x brush").call(E).selectAll("rect").attr("height",fa),w.append("g").attr("class","x axis").attr("transform",I.subx).call(za));sa&&$a(c);ec(c);z({withTransition:!1,withUpdateXDomain:!0});
if(Pc){if(D&&"string"==typeof ta){ta=ia(ta);for(a=0;a<c[0].values.length&&0!=c[0].values[a].x-ta;a++);ta=a}Z.html(dc(c.map(function(a){return ca(a.values[ta])})));Z.style("top",fc.top).style("left",fc.left).style("visibility","visible")}}function z(a){var c,d=Bc(),b=d.__max__+1,f,h,p,r,u,q;a=l(a)?a:{};c=l(a.withY)?a.withY:!0;u=l(a.withSubchart)?a.withSubchart:!0;q=l(a.withTransition)?a.withTransition:!0;a=l(a.withUpdateXDomain)?a.withUpdateXDomain:!1;q=q?250:0;a&&(m.domain(E.empty()?P:E.extent()),
ja&&F.x(m).updateScaleExtent());x.domain(B(k.data.targets,"y"));O.domain(B(k.data.targets,"y2"));g.select(".x.axis").transition().duration(e?q:0).call(e?ga:M);g.select(".y.axis").transition().duration(e?0:q).call(e?M:ga);g.select(".y2.axis").transition().call(Sa);Qa.domain(x.domain());Ra.domain(O.domain());Z.style("visibility","hidden");g.select("line.xgrid-focus").style("visibility","hidden").attr("y2",s);if($b){if("year"===Qc)for(a=[],firstYear=Wa.getFullYear(),lastYear=hb.getFullYear(),f=firstYear;f<=
lastYear;f++)a.push(new Date(f+"-01-01 00:00:00"));else a=m.ticks(10);a=g.select(".xgrids").selectAll(".xgrid").data(a);a.enter().append("line").attr("class","xgrid");a.exit().remove();g.selectAll(".xgrid").attr("x1",function(a){return m(a)-M.tickOffset()}).attr("x2",function(a){return m(a)-M.tickOffset()}).attr("y1",v).attr("y2",s)}qb&&(a=g.selectAll(".xgrid-lines"),a.selectAll("line").attr("x1",e?0:Fa).attr("x2",e?t:Fa).attr("y1",e?Fa:v).attr("y2",e?Fa:s),a.selectAll("text").attr("x",e?t:0).attr("y",
Fa));c&&ac&&(ygrid=g.select(".ygrids").selectAll(".ygrid").data(x.ticks(10)),ygrid.enter().append("line").attr("class","ygrid"),ygrid.attr("x1",e?x:0).attr("x2",e?x:t).attr("y1",e?0:x).attr("y2",e?s:x).attr("opacity",0).transition().attr("opacity",1),ygrid.exit().remove());c&&rb&&g.select(".ygrid-lines").selectAll(".ygrid-line").attr("y1",Pb).attr("y2",Pb);h=ha?1.2*M.tickOffset()/b:0.6*((e?s:t)*T(!1)/(Ea()-1));p=Sb(e?null:s);a=Qb(h,b,d);f=Rb(p,d,e);c=g.selectAll(".-bars").selectAll(".-bar").data(Tb);
c.transition().duration(q).attr("x",e?f:a).attr("y",e?a:f).attr("width",e?p:h).attr("height",e?h:p);c.enter().append("rect").attr("class",Ob).attr("x",e?f:a).attr("y",e?a:f).attr("width",e?p:h).attr("height",e?h:p).style("opacity",0).transition().duration(q).style("opacity",1);c.exit().transition().duration(q).style("opacity",0).remove();g.selectAll(".-line").transition().duration(q).attr("d",Rc);c=g.selectAll(".-circles").selectAll(".-circle").data(Cc);c.transition().duration(q).attr("cx",e?X:W).attr("cy",
"x axis").attr("clip-path",e?"":"url(#xaxis-clip)").attr("transform",I.x).call(e?ga:M);g.append("g").attr("class","y axis").attr("clip-path",e?"url(#yaxis-clip)":"").call(e?M:ga).append("text").attr("transform","rotate(-90)").attr("dy","1.4em").attr("dx","-.8em").style("text-anchor","end").text(Mc);Fb&&g.append("g").attr("class","y2 axis").attr("transform",I.y2).call(Sa);d=g.append("g").attr("clip-path",Ia).attr("class","grid");$b&&d.append("g").attr("class","xgrids");qb&&(b=d.append("g").attr("class",
"xgrid-lines").selectAll(".xgrid-line").data(qb).enter().append("g").attr("class","xgrid-line"),b.append("line").attr("class",function(a){return""+a["class"]}),b.append("text").attr("class",function(a){return""+a["class"]}).attr("text-anchor","end").attr("transform",e?"":"rotate(-90)").attr("dx",e?0:-v).attr("dy",-6).text(function(a){return a.text}));Nc&&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:v).attr("y2",
e?-10:s);ac&&d.append("g").attr("class","ygrids");rb&&d.append("g").attr("class","ygrid-lines").selectAll("ygrid-line").data(rb).enter().append("line").attr("class",function(a){return"ygrid-line "+a["class"]});g.append("g").attr("clip-path",Ia).attr("class","regions");g.append("g").attr("clip-path",Ia).attr("class","chart");g.select(".chart").append("g").attr("class","event-rects").style("fill-opacity",0).style("cursor",ja?"ew-resize":null).selectAll(".event-rects").data(a).enter().append("rect").attr("class",
function(a,c){return"event-rect event-rect-"+c}).style("cursor",$&&ka?"pointer":null).on("mouseover",function(a,c){if(!Za){var d=k.data.targets.map(function(a){return ca(a.values[c])}),b,n;if(0<Object.keys(Da).length){n=[];for(var h in Da)for(b=0;b<d.length;b++)if(d[b].id===h){n.push(d[b]);d.shift(b);break}d=n.concat(d)}bc&&g.selectAll(".-circle-"+c).classed(aa,!0).attr("r",cc);g.selectAll(".-bar-"+c).classed(aa,!0);g.selectAll("line.xgrid-focus").style("visibility","visible").data([d[0]]).attr(e?
"y1":"x1",Xa).attr(e?"y2":"x2",Xa);Z.style("top",d3.mouse(this)[1]+30+"px").style("left",(e?d3.mouse(this)[0]:m(d[0].x))+60+"px");Z.html(dc(d));Z.style("visibility","visible")}}).on("mouseout",function(a,c){g.select("line.xgrid-focus").style("visibility","hidden");Z.style("visibility","hidden");g.selectAll(".-circle-"+c).filter(function(){return d3.select(this).classed(aa)}).classed(aa,!1).attr("r",sb);g.selectAll(".-bar-"+c).classed(aa,!1)}).on("mousemove",function(a,c){$&&!Za&&(ka||g.selectAll(".-shape-"+
c).filter(function(a){return la(a)}).each(function(a){a=d3.select(this).classed(aa,!0);"circle"===this.nodeName&&a.attr("r",cc);d3.select(".event-rect-"+c).style("cursor",null)}).filter(function(a){a=d3.select(this);if("circle"===this.nodeName)return Ub(this,Ga);if("rect"===this.nodeName)return Vb(this,a.attr("x"),a.attr("y"))}).each(function(a){a=d3.select(this);a.classed(aa)||(a.classed(aa,!0),"circle"===this.nodeName&&a.attr("r",Ga));d3.select(".event-rect-"+c).style("cursor","pointer")}))}).on("click",
function(a,c){tb?tb=!1:g.selectAll(".-shape-"+c).each(function(a){var d=d3.select(this),b=d.classed(ba),f=!1,e;"circle"===this.nodeName?(f=Ub(this,1.5*Ga),e=Xb):"rect"===this.nodeName&&(f=Vb(this),e=Zb);if(ka||f)$&&la(a)&&(d.classed(ba,!b),e(!b,d,a,c)),Oc(a,d)})}).call(d3.behavior.drag().origin(Object).on("drag",function(a){if($&&(!ja||F.altDomain)){a=ub[0];var c=ub[1],d=d3.mouse(this),b=d[0],d=d[1],e=Math.min(a,b),n=Math.max(a,b),k=ka?v:Math.min(c,d),h=ka?s:Math.max(c,d);g.select(".dragarea").attr("x",
e).attr("y",k).attr("width",n-e).attr("height",h-k);g.selectAll(".-shapes").selectAll(".-shape").filter(function(a){return la(a)}).each(function(a,c){var d=d3.select(this),b=d.classed(ba),f=d.classed(vb),g,p,m,l;g=!1;"circle"===this.nodeName?(g=1*d.attr("cx"),p=1*d.attr("cy"),l=Xb,g=e<g&&g<n&&k<p&&p<h):"rect"===this.nodeName&&(g=1*d.attr("x"),p=1*d.attr("y"),m=1*d.attr("width"),l=Zb,g=e<g+m&&g<n&&p<h);g^f&&(d.classed(vb,!f),d.classed(ba,!b),l(!b,d,a,c))})}}).on("dragstart",function(){$&&(ub=d3.mouse(this),
g.select(".chart").append("rect").attr("class","dragarea").style("opacity",0.1),Za=!0)}).on("dragend",function(){$&&(g.select(".dragarea").transition().duration(100).style("opacity",0).remove(),g.selectAll(".-shape").classed(vb,!1),Za=!1)})).call(F).on("dblclick.zoom",null);g.select(".chart").append("g").attr("class","chart-bars");g.select(".chart").append("g").attr("class","chart-lines");if(ja)g.insert("rect",Pc?null:"g.grid").attr("class","zoom-rect").attr("width",t).attr("height",s).style("opacity",
0).style("cursor","ew-resize").call(F).on("dblclick.zoom",null);null!==Ja&&E.extent("function"!==typeof Ja?Ja:D?Ja(Wa,hb):Ja(0,Ea()-1));qa&&(w.append("g").attr("clip-path",Ia).attr("class","chart"),w.select(".chart").append("g").attr("class","chart-bars"),w.select(".chart").append("g").attr("class","chart-lines"),w.append("g").attr("clip-path",Ia).attr("class","x brush").call(E).selectAll("rect").attr("height",fa),w.append("g").attr("class","x axis").attr("transform",I.subx).call(za));sa&&$a(c);ec(c);
z({withTransition:!1,withUpdateXDomain:!0});if(Qc){if(D&&"string"==typeof ta){ta=ia(ta);for(a=0;a<c[0].values.length&&0!=c[0].values[a].x-ta;a++);ta=a}Z.html(dc(c.map(function(a){return ca(a.values[ta])})));Z.style("top",fc.top).style("left",fc.left).style("visibility","visible")}}function z(a){var c,d=Bc(),b=d.__max__+1,f,h,p,r,u,q;a=l(a)?a:{};c=l(a.withY)?a.withY:!0;u=l(a.withSubchart)?a.withSubchart:!0;q=l(a.withTransition)?a.withTransition:!0;a=l(a.withUpdateXDomain)?a.withUpdateXDomain:!1;q=
q?250:0;a&&(m.domain(E.empty()?P:E.extent()),ja&&F.x(m).updateScaleExtent());x.domain(B(k.data.targets,"y"));O.domain(B(k.data.targets,"y2"));g.select(".x.axis").transition().duration(e?q:0).call(e?ga:M);g.select(".y.axis").transition().duration(e?0:q).call(e?M:ga);g.select(".y2.axis").transition().call(Sa);Qa.domain(x.domain());Ra.domain(O.domain());Z.style("visibility","hidden");g.select("line.xgrid-focus").style("visibility","hidden").attr("y2",s);if($b){if("year"===Rc)for(a=[],firstYear=Wa.getFullYear(),
lastYear=hb.getFullYear(),f=firstYear;f<=lastYear;f++)a.push(new Date(f+"-01-01 00:00:00"));else a=m.ticks(10);a=g.select(".xgrids").selectAll(".xgrid").data(a);a.enter().append("line").attr("class","xgrid");a.exit().remove();g.selectAll(".xgrid").attr("x1",function(a){return m(a)-M.tickOffset()}).attr("x2",function(a){return m(a)-M.tickOffset()}).attr("y1",v).attr("y2",s)}qb&&(a=g.selectAll(".xgrid-lines"),a.selectAll("line").attr("x1",e?0:Fa).attr("x2",e?t:Fa).attr("y1",e?Fa:v).attr("y2",e?Fa:s),
a.selectAll("text").attr("x",e?t:0).attr("y",Fa));c&&ac&&(ygrid=g.select(".ygrids").selectAll(".ygrid").data(x.ticks(10)),ygrid.enter().append("line").attr("class","ygrid"),ygrid.attr("x1",e?x:0).attr("x2",e?x:t).attr("y1",e?0:x).attr("y2",e?s:x).attr("opacity",0).transition().attr("opacity",1),ygrid.exit().remove());c&&rb&&g.select(".ygrid-lines").selectAll(".ygrid-line").attr("y1",Pb).attr("y2",Pb);h=ha?1.2*M.tickOffset()/b:0.6*((e?s:t)*T(!1)/(Ea()-1));p=Sb(e?null:s);a=Qb(h,b,d);f=Rb(p,d,e);c=g.selectAll(".-bars").selectAll(".-bar").data(Tb);
c.transition().duration(q).attr("x",e?f:a).attr("y",e?a:f).attr("width",e?p:h).attr("height",e?h:p);c.enter().append("rect").attr("class",Ob).attr("x",e?f:a).attr("y",e?a:f).attr("width",e?p:h).attr("height",e?h:p).style("opacity",0).transition().duration(q).style("opacity",1);c.exit().transition().duration(q).style("opacity",0).remove();g.selectAll(".-line").transition().duration(q).attr("d",Sc);c=g.selectAll(".-circles").selectAll(".-circle").data(Cc);c.transition().duration(q).attr("cx",e?X:W).attr("cy",
e?W:X);c.enter().append("circle").attr("class",zc).attr("cx",e?X:W).attr("cy",e?W:X).attr("r",sb);c.exit().remove();qa&&(null!==d3.event&&"zoom"===d3.event.type&&E.extent(m.orgDomain()).update(),u&&(w.select(".x.axis").transition().duration(e?q:0).call(e?ga:za),E.empty()||E.extent(m.orgDomain()).update(),h=ha?1.2*za.tickOffset()/b:0.6*((e?s:t)*T(!0)/(Ea()-1)),p=Sb(fa,!0),a=Qb(h,b,d,!0),f=Rb(p,d,!1,!0),contextBar=w.selectAll(".-bars").selectAll(".-bar").data(Tb),contextBar.transition().duration(q).attr("x",
a).attr("y",f).attr("width",h).attr("height",p),contextBar.enter().append("rect").attr("class",Ob).attr("x",a).attr("y",f).attr("width",h).attr("height",p).style("opacity",0).transition().style("opacity",1),contextBar.exit().transition().style("opacity",0).remove(),w.selectAll(".-line").transition().duration(q).attr("d",Sc)));g.selectAll(".selected-circles").filter(function(a){return Aa(a)}).selectAll("circle").remove();g.selectAll(".selected-circle").transition().duration(q).attr("cx",e?X:W).attr("cy",
a).attr("y",f).attr("width",h).attr("height",p),contextBar.enter().append("rect").attr("class",Ob).attr("x",a).attr("y",f).attr("width",h).attr("height",p).style("opacity",0).transition().style("opacity",1),contextBar.exit().transition().style("opacity",0).remove(),w.selectAll(".-line").transition().duration(q).attr("d",Tc)));g.selectAll(".selected-circles").filter(function(a){return Aa(a)}).selectAll("circle").remove();g.selectAll(".selected-circle").transition().duration(q).attr("cx",e?X:W).attr("cy",
e?W:X);r=(e?s:t)*T()/(Ea()-1);d=function(a){return m(a.x)-r/2};g.selectAll(".event-rect").attr("x",e?0:d).attr("y",e?d:0).attr("width",e?t:r).attr("height",e?r:s);mainRegion=g.select(".regions").selectAll("rect.region").data(J);mainRegion.enter().append("rect");mainRegion.attr("class",Ac).attr("x",e?0:oa).attr("y",e?oa:v).attr("width",e?t:va).attr("height",e?va:s).style("fill-opacity",function(a){return l(a.opacity)?a.opacity:0.1});mainRegion.exit().transition().duration(q).style("fill-opacity",0).remove()}
function Tc(){"mousemove"===d3.event.sourceEvent.type&&F.altDomain?(m.domain(F.altDomain),F.x(m).updateScaleExtent()):(ha&&m.orgDomain()[0]===P[0]&&m.domain([P[0]-1E-10,m.orgDomain()[1]]),z({withTransition:!1,withY:!1,withSubchart:!1}),"mousemove"===d3.event.sourceEvent.type&&(tb=!0))}function ec(a){var c;g.select(".chart-bars").selectAll(".chart-bar").data(a).enter().append("g").attr("class",function(a){return"chart-bar target target-"+a.id}).style("pointer-events","none").style("opacity",0).append("g").attr("class",
function Uc(){"mousemove"===d3.event.sourceEvent.type&&F.altDomain?(m.domain(F.altDomain),F.x(m).updateScaleExtent()):(ha&&m.orgDomain()[0]===P[0]&&m.domain([P[0]-1E-10,m.orgDomain()[1]]),z({withTransition:!1,withY:!1,withSubchart:!1}),"mousemove"===d3.event.sourceEvent.type&&(tb=!0))}function ec(a){var c;g.select(".chart-bars").selectAll(".chart-bar").data(a).enter().append("g").attr("class",function(a){return"chart-bar target target-"+a.id}).style("pointer-events","none").style("opacity",0).append("g").attr("class",
Nb).style("fill",function(a){return Q(a.id)}).style("stroke",function(a){return Q(a.id)}).style("stroke-width",0).style("cursor",function(a){return la(a)?"pointer":null});c=g.select(".chart-lines").selectAll(".chart-line").data(a).enter().append("g").attr("class",function(a){return"chart-line target target-"+a.id}).style("pointer-events","none").style("opacity",0);c.append("path").attr("class",Mb).style("stroke",function(a){return Q(a.id)});c.append("g").attr("class",function(a){return"selected-circles selected-circles-"+
a.id});c.append("g").attr("class",yc).style("fill",function(a){return Q(a.id)}).style("cursor",function(a){return la(a)?"pointer":null});a.forEach(function(a){g.selectAll(".selected-circles-"+a.id).selectAll(".selected-circle").each(function(c){c.value=a.values[c.x].value})});qa&&(c=w.select(".chart-bars").selectAll(".chart-bar").data(a),c=c.enter().append("g").attr("class",function(a){return"chart-bar target target-"+a.id}).style("opacity",0),c.append("g").attr("class",Nb).style("fill",function(a){return Q(a.id)}),
c=w.select(".chart-lines").selectAll(".chart-line").data(a),c=c.enter().append("g").attr("class",function(a){return"chart-line target target-"+a.id}).style("opacity",0),c.append("path").attr("class",Mb).style("stroke",function(a){return Q(a.id)}));sa&&$a(a);d3.selectAll(".target").transition().style("opacity",1)}function Ka(a,c){k.data.targets.forEach(function(c){for(var b=0;b<a.length;b++)if(c.id===a[b].id){c.values=a[b].values;a.splice(b,1);break}});k.data.targets=k.data.targets.concat(a);ec(k.data.targets);
z();c()}function $a(a,c){var b=ib(a),e,f=t/2-La*Object.keys(a).length/2,g;c=u(c)?{}:c;g=l(c.withTransition)?c.withTransition:!0;e=ra.selectAll(".legend-item").data(b).enter().append("g").attr("class",function(a){return"legend-item legend-item-"+a}).style("cursor","pointer").on("click",function(a){Uc(a)}).on("mouseover",function(a){d3.selectAll(".legend-item").filter(function(c){return c!==a}).transition().duration(100).style("opacity",0.3);k.focus(a)}).on("mouseout",function(a){d3.selectAll(".legend-item").transition().duration(100).style("opacity",
z();c()}function $a(a,c){var b=ib(a),e,f=t/2-La*Object.keys(a).length/2,g;c=u(c)?{}:c;g=l(c.withTransition)?c.withTransition:!0;e=ra.selectAll(".legend-item").data(b).enter().append("g").attr("class",function(a){return"legend-item legend-item-"+a}).style("cursor","pointer").on("click",function(a){Vc(a)}).on("mouseover",function(a){d3.selectAll(".legend-item").filter(function(c){return c!==a}).transition().duration(100).style("opacity",0.3);k.focus(a)}).on("mouseout",function(a){d3.selectAll(".legend-item").transition().duration(100).style("opacity",
1);k.revert()});e.append("rect").attr("class","legend-item-event").style("fill-opacity",0).attr("x",-200).attr("y",function(){return ea/2-16}).attr("width",La).attr("height",24);e.append("rect").attr("class","legend-item-tile").style("fill",function(a){return Q(a)}).attr("x",-200).attr("y",function(){return ea/2-9}).attr("width",10).attr("height",10);e.append("text").text(function(a){return l(Da[a])?Da[a]:a}).attr("x",-200).attr("y",function(a,c){return ea/2});ra.selectAll("rect.legend-item-event").data(b).transition().duration(g?
250:0).attr("x",function(a,c){return f+La*c});ra.selectAll("rect.legend-item-tile").data(b).transition().duration(g?250:0).attr("x",function(a,c){return f+La*c});ra.selectAll("text").data(b).transition().duration(g?250:0).attr("x",function(a,c){return f+La*c+14})}function Ma(a){return l(a)?".target-"+a:".target"}var k={data:{}},Ua={},aa="_expanded_",ba="_selected_",vb="_included_",ya=b(["bindto"],"#chart"),Ab=b(["size","width"],null),Bb=b(["size","height"],null),ja=b(["zoom","enabled"],!1),gc=b(["zoom",
"extent"],null);if(!("data"in R))throw Error("data is required in config");var Va=b(["data","x"],"x"),Vc=b(["data","x_format"],"%Y-%m-%d"),xc=b(["data","id_converter"],function(a){return a}),Da=b(["data","names"],{}),q=b(["data","groups"],[]),Lb=b(["data","axes"],{}),Y=b(["data","types"],{}),hc=b(["data","regions"],{}),Wc=b(["data","colors"],{}),$=b(["data","selection","enabled"],!1),ka=b(["data","selection","grouped"],!1),la=b(["data","selection","isselectable"],function(a){return!0}),qa=b(["subchart",
"show"],!1),Db=qa?b(["subchart","size","height"],60):0,Xc=b(["color","pattern"],null),sa=b(["legend","show"],!0),La=b(["legend","item","width"],80),Uc=b(["legend","item","onclick"],function(){}),ic=b(["axis","x","type"],"indexed"),gb=b(["axis","x","categories"],[]),pc=b(["axis","x","tick","centered"],!1),Ja=b(["axis","x","default"],null),tc=b(["axis","y","max"],null),rc=b(["axis","y","min"],null),vc=b(["axis","y","center"],null),Mc=b(["axis","y","text"],null);b(["axis","y","rescale"],!0);var db=b(["axis",
"y","inner"],!1),Jc=b(["axis","y","format"],function(a){return a}),Ba=b(["axis","y","padding"],null),Ic=b(["axis","y","ticks"],10),Fb=b(["axis","y2","show"],!1),sc=b(["axis","y2","max"],null),qc=b(["axis","y2","min"],null),uc=b(["axis","y2","center"],null);b(["axis","y2","text"],null);b(["axis","y2","rescale"],!0);var cb=b(["axis","y2","inner"],!1),Lc=b(["axis","y2","format"],function(a){return a}),Ca=b(["axis","y2","padding"],null),Kc=b(["axis","y2","ticks"],10),e=b(["axis","rotated"],!1),$b=b(["grid",
"x","show"],!1),Qc=b(["grid","x","type"],"tick"),qb=b(["grid","x","lines"],null),ac=b(["grid","y","show"],!1);b(["grid","y","type"],"tick");var rb=b(["grid","y","lines"],null),sb=b(["point","show"],!0)?b(["point","r"],2.5):0,Nc=b(["point","focus","line","enabled"],!0),bc=b(["point","focus","expand","enabled"],!0),cc=b(["point","focus","expand","r"],bc?4:sb),Ga=b(["point","focus","select","r"],8),Oc=b(["point","onclick"],function(){}),Ec=b(["point","onselected"],function(){}),Fc=b(["point","onunselected"],
function(){}),J=b(["regions"],[]),dc=b(["tooltip","contents"],function(a){var c="<table class='-tooltip'><tr><th colspan='2'>"+(D?a[0].x.getFullYear()+"."+(a[0].x.getMonth()+1)+"."+a[0].x.getDate():ha?a[0].x<gb.length?gb[a[0].x]:a[0].x:a[0].x)+"</th></tr>",b,e,f;for(b=0;b<a.length;b++)l(a[b])?(e=l(a[b].value)?(Math.round(100*a[b].value)/100).toFixed(2):"-",f=a[b].name):f=e="-",c+="<tr><td><span style='background-color:"+Q(a[b].id)+"'></span>"+f+"</td><td class='value'>"+e+"</td></tr>";return c+"</table>"}),
Pc=b(["tooltip","init","show"],!1),ta=b(["tooltip","init","x"],0),fc=b(["tooltip","init","position"],{top:"0px",left:"50px"}),pb=ya.replace("#","")+"-clip",Ia="url(#"+pb+")",D="timeseries"===ic,ha="categorized"===ic,ub=null,Za=!1,tb=!1,ea=sa?40:0,ia=d3.time.format(Vc).parse,Q=function(a,c){var b=[],e=null!==c?c:"#1f77b4 #ff7f0e #2ca02c #d62728 #9467bd #8c564b #e377c2 #7f7f7f #bcbd22 #17becf".split(" ");return function(c){if(c in a)return a[c];0<=b.indexOf(c)||b.push(c);return e[b.indexOf(c)%e.length]}}(Wc,
Xc),oc=function(){var a=[[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()}]];
return function(c){for(var b=a.length-1,e=a[b];!e[1](c);)e=a[--b];return e[0](c)}}(),Cb,Hb,Eb,Pa,Gb,Ib,t,s,fa,bb,pa,Jb,Kb,eb,fb,m,x,O,V,Qa,Ra,M,ga,Sa,za,kc=e?"left":"bottom",lc=e?db?"top":"bottom":db?"right":"left",mc=e?cb?"bottom":"top":cb?"left":"right",nc="bottom",I={main:function(){return"translate("+H+","+v+")"},context:function(){return"translate("+G+","+ua+")"},legend:function(){return"translate("+Oa+","+xb+")"},y2:function(){return"translate("+(e?0:t)+","+(e?10:0)+")"},x:function(){return"translate(0,"+
s+")"},subx:function(){return"translate(0,"+fa+")"}},Rc=function(){var a=d3.svg.line().x(e?function(a){return h(a.id)(a.value)}:Xa).y(e?Xa:function(a){return h(a.id)(a.value)});return function(c){var b;if(mb(c))return"spline"===Y["string"===typeof c?c:c.id]?a.interpolate("cardinal"):a.interpolate("linear"),0<Object.keys(hc).length?Hc(c.values,m,h(c.id),hc[c.id]):a(c.values);b=m(c.values[0].x);c=h(c.id)(c.values[0].value);return e?"M "+c+" "+b:"M "+b+" "+c}}(),Sc=function(){var a=d3.svg.line().x(function(a){return V(a.x)}).y(function(a){return Na(a.id)(a.value)});
return function(c){return mb(c)?a(c.values):"M "+V(c.values[0].x)+" "+Na(c.id)(c.values[0].value)}}(),E=d3.svg.brush().on("brush",function(){z({withTransition:!1,withY:!1,withSubchart:!1,withUpdateXDomain:!0})}),F=d3.behavior.zoom().on("zoomstart",function(){F.altDomain=d3.event.sourceEvent.altKey?m.orgDomain():null}).on("zoom",ja?Tc:null);E.update=function(){w&&w.select(".x.brush").call(this);return this};F.orgScaleExtent=function(){var a=gc?gc:[1,10];return[a[0],Math.max(Ea()/a[1],a[1])]};F.updateScaleExtent=
function(){var a=m.orgDomain(),a=(a[1]-a[0])/(P[1]-P[0]),c=this.orgScaleExtent();this.scaleExtent([c[0]*a,c[1]*a]);return this};var Ha,Ya,g,w,ra,Z,Wa=null,hb=null,P;k.focus=function(a){k.defocus();d3.selectAll(Ma(a)).filter(function(a){return jb(a.id)}).classed("focused",!0).transition().duration(100).style("opacity",1)};k.defocus=function(a){d3.selectAll(Ma(a)).filter(function(a){return jb(a.id)}).classed("focused",!1).transition().duration(100).style("opacity",0.3)};k.revert=function(a){d3.selectAll(Ma(a)).filter(function(a){return jb(a.id)}).classed("focused",
!1).transition().duration(100).style("opacity",1)};k.show=function(a){d3.selectAll(Ma(a)).transition().style("opacity",1)};k.hide=function(a){d3.selectAll(Ma(a)).transition().style("opacity",0)};k.unzoom=function(){E.clear().update();z({withUpdateXDomain:!0})};k.load=function(a){u(a.done)&&(a.done=function(){});if("cacheIds"in a&&K(a.cacheIds))Ka(ab(a.cacheIds),a.done);else if("data"in a)Ka(da(data),a.done);else if("url"in a)d3.csv(a.url,function(c,b){Ka(da(b),a.done)});else if("rows"in a)Ka(da(wa(a.rows)),
a.done);else if("columns"in a)Ka(da(xa(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(c){return c.id!=a});d3.selectAll(".target-"+a).transition().style("opacity",0).remove();sa&&(d3.selectAll(".legend-item-"+a).remove(),$a(k.data.targets));0<k.data.targets.length&&z()};k.selected=function(a){a=l(a)?"-"+a:"";return d3.merge(g.selectAll(".-shapes"+a).selectAll(".-shape").filter(function(){return d3.select(this).classed(ba)}).map(function(a){return a.map(function(a){return a.__data__})}))};
k.select=function(a,c,b){$&&g.selectAll(".-shapes").selectAll(".-shape").each(function(e,f){var g="circle"===this.nodeName?Wb:Gc,h="circle"===this.nodeName?nb:Yb;0<=c.indexOf(f)?la(e)&&(ka||u(a)||0<=a.indexOf(e.id))&&g(d3.select(this).classed(ba,!0),e,f):l(b)&&b&&h(d3.select(this).classed(ba,!1),e,f)})};k.unselect=function(a,c){$&&g.selectAll(".-shapes").selectAll(".-shape").each(function(b,e){var f="circle"===this.nodeName?nb:Yb;(u(c)||0<=c.indexOf(e))&&la(b)&&(ka||u(a)||0<=a.indexOf(b.id))&&f(d3.select(this).classed(ba,
!1),b,e)})};k.toLine=function(a){lb(a,"line");z()};k.toSpline=function(a){lb(a,"spline");z()};k.toBar=function(a){lb(a,"bar");z()};k.groups=function(a){if(u(a))return q;q=a;z();return q};k.regions=function(a){if(u(a))return J;J=a;z();return J};k.regions.add=function(a){if(u(a))return J;J=J.concat(a);z();return J};k.regions.remove=function(a,b){var d=[].concat(a);b=l(b)?b:{};d.forEach(function(a){var d=d3.selectAll("."+a);l(b.duration)&&(d=d.transition().duration(b.duration).style("fill-opacity",0));
d.remove();J=J.filter(function(b){return 0>b.classes.indexOf(a)})});return J};k.data.get=function(a){a=k.data.getAsTarget(a);return l(a)?a.values.map(function(a){return a.value}):void 0};k.data.getAsTarget=function(a){var b=Ta(function(b){return b.id==a});return 0<b.length?b[0]:void 0};if("url"in R.data)d3.csv(R.data.url,function(a,b){ob(b)});else if("rows"in R.data)ob(wa(R.data.rows));else if("columns"in R.data)ob(xa(R.data.columns));else throw Error("url or rows or columns is required.");wb.onresize=
function(){N();S();E.x(V);ja&&F.x(m);d3.select("svg").attr("width",bb).attr("height",pa);d3.select("#"+pb).select("rect").attr("width",t).attr("height",s);d3.select("#xaxis-clip").select("rect").attr("width",t+2);d3.select(".zoom-rect").attr("width",t).attr("height",s);g.select(".x.axis").attr("transform",I.x);g.select(".y2.axis").attr("transform",I.y2);qa&&(w.select(".x.brush").selectAll("rect").attr("height",fa),w.attr("transform",I.context),w.select(".x.axis").attr("transform",I.subx));sa&&(ra.attr("transform",
I.legend),$a(k.data.targets,{withTransition:!1}));z({withTransition:!1,withUpdateXDomain:!0})};return k}})(window);
"extent"],null),Pc=b(["zoom","privileged"],!1);if(!("data"in R))throw Error("data is required in config");var Va=b(["data","x"],"x"),Wc=b(["data","x_format"],"%Y-%m-%d"),xc=b(["data","id_converter"],function(a){return a}),Da=b(["data","names"],{}),q=b(["data","groups"],[]),Lb=b(["data","axes"],{}),Y=b(["data","types"],{}),hc=b(["data","regions"],{}),Xc=b(["data","colors"],{}),$=b(["data","selection","enabled"],!1),ka=b(["data","selection","grouped"],!1),la=b(["data","selection","isselectable"],function(a){return!0}),
qa=b(["subchart","show"],!1),Db=qa?b(["subchart","size","height"],60):0,Yc=b(["color","pattern"],null),sa=b(["legend","show"],!0),La=b(["legend","item","width"],80),Vc=b(["legend","item","onclick"],function(){}),ic=b(["axis","x","type"],"indexed"),gb=b(["axis","x","categories"],[]),pc=b(["axis","x","tick","centered"],!1),Ja=b(["axis","x","default"],null),tc=b(["axis","y","max"],null),rc=b(["axis","y","min"],null),vc=b(["axis","y","center"],null),Mc=b(["axis","y","text"],null);b(["axis","y","rescale"],
!0);var db=b(["axis","y","inner"],!1),Jc=b(["axis","y","format"],function(a){return a}),Ba=b(["axis","y","padding"],null),Ic=b(["axis","y","ticks"],10),Fb=b(["axis","y2","show"],!1),sc=b(["axis","y2","max"],null),qc=b(["axis","y2","min"],null),uc=b(["axis","y2","center"],null);b(["axis","y2","text"],null);b(["axis","y2","rescale"],!0);var cb=b(["axis","y2","inner"],!1),Lc=b(["axis","y2","format"],function(a){return a}),Ca=b(["axis","y2","padding"],null),Kc=b(["axis","y2","ticks"],10),e=b(["axis",
"rotated"],!1),$b=b(["grid","x","show"],!1),Rc=b(["grid","x","type"],"tick"),qb=b(["grid","x","lines"],null),ac=b(["grid","y","show"],!1);b(["grid","y","type"],"tick");var rb=b(["grid","y","lines"],null),sb=b(["point","show"],!0)?b(["point","r"],2.5):0,Nc=b(["point","focus","line","enabled"],!0),bc=b(["point","focus","expand","enabled"],!0),cc=b(["point","focus","expand","r"],bc?4:sb),Ga=b(["point","focus","select","r"],8),Oc=b(["point","onclick"],function(){}),Ec=b(["point","onselected"],function(){}),
Fc=b(["point","onunselected"],function(){}),J=b(["regions"],[]),dc=b(["tooltip","contents"],function(a){var c="<table class='-tooltip'><tr><th colspan='2'>"+(D?a[0].x.getFullYear()+"."+(a[0].x.getMonth()+1)+"."+a[0].x.getDate():ha?a[0].x<gb.length?gb[a[0].x]:a[0].x:a[0].x)+"</th></tr>",b,e,f;for(b=0;b<a.length;b++)l(a[b])?(e=l(a[b].value)?(Math.round(100*a[b].value)/100).toFixed(2):"-",f=a[b].name):f=e="-",c+="<tr><td><span style='background-color:"+Q(a[b].id)+"'></span>"+f+"</td><td class='value'>"+
e+"</td></tr>";return c+"</table>"}),Qc=b(["tooltip","init","show"],!1),ta=b(["tooltip","init","x"],0),fc=b(["tooltip","init","position"],{top:"0px",left:"50px"}),pb=ya.replace("#","")+"-clip",Ia="url(#"+pb+")",D="timeseries"===ic,ha="categorized"===ic,ub=null,Za=!1,tb=!1,ea=sa?40:0,ia=d3.time.format(Wc).parse,Q=function(a,c){var b=[],e=null!==c?c:"#1f77b4 #ff7f0e #2ca02c #d62728 #9467bd #8c564b #e377c2 #7f7f7f #bcbd22 #17becf".split(" ");return function(c){if(c in a)return a[c];0<=b.indexOf(c)||
b.push(c);return e[b.indexOf(c)%e.length]}}(Xc,Yc),oc=function(){var a=[[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()}]];return function(c){for(var b=a.length-1,e=a[b];!e[1](c);)e=a[--b];return e[0](c)}}(),Cb,Hb,Eb,Pa,Gb,Ib,t,s,fa,bb,pa,Jb,Kb,eb,fb,m,x,O,V,Qa,Ra,M,ga,Sa,za,kc=e?"left":"bottom",lc=e?db?"top":"bottom":db?"right":"left",mc=e?cb?"bottom":"top":cb?"left":"right",nc="bottom",I={main:function(){return"translate("+H+","+v+")"},context:function(){return"translate("+G+","+ua+")"},legend:function(){return"translate("+Oa+","+xb+")"},y2:function(){return"translate("+
(e?0:t)+","+(e?10:0)+")"},x:function(){return"translate(0,"+s+")"},subx:function(){return"translate(0,"+fa+")"}},Sc=function(){var a=d3.svg.line().x(e?function(a){return h(a.id)(a.value)}:Xa).y(e?Xa:function(a){return h(a.id)(a.value)});return function(c){var b;if(mb(c))return"spline"===Y["string"===typeof c?c:c.id]?a.interpolate("cardinal"):a.interpolate("linear"),0<Object.keys(hc).length?Hc(c.values,m,h(c.id),hc[c.id]):a(c.values);b=m(c.values[0].x);c=h(c.id)(c.values[0].value);return e?"M "+c+
" "+b:"M "+b+" "+c}}(),Tc=function(){var a=d3.svg.line().x(function(a){return V(a.x)}).y(function(a){return Na(a.id)(a.value)});return function(c){return mb(c)?a(c.values):"M "+V(c.values[0].x)+" "+Na(c.id)(c.values[0].value)}}(),E=d3.svg.brush().on("brush",function(){z({withTransition:!1,withY:!1,withSubchart:!1,withUpdateXDomain:!0})}),F=d3.behavior.zoom().on("zoomstart",function(){F.altDomain=d3.event.sourceEvent.altKey?m.orgDomain():null}).on("zoom",ja?Uc:null);E.update=function(){w&&w.select(".x.brush").call(this);
return this};F.orgScaleExtent=function(){var a=gc?gc:[1,10];return[a[0],Math.max(Ea()/a[1],a[1])]};F.updateScaleExtent=function(){var a=m.orgDomain(),a=(a[1]-a[0])/(P[1]-P[0]),c=this.orgScaleExtent();this.scaleExtent([c[0]*a,c[1]*a]);return this};var Ha,Ya,g,w,ra,Z,Wa=null,hb=null,P;k.focus=function(a){k.defocus();d3.selectAll(Ma(a)).filter(function(a){return jb(a.id)}).classed("focused",!0).transition().duration(100).style("opacity",1)};k.defocus=function(a){d3.selectAll(Ma(a)).filter(function(a){return jb(a.id)}).classed("focused",
!1).transition().duration(100).style("opacity",0.3)};k.revert=function(a){d3.selectAll(Ma(a)).filter(function(a){return jb(a.id)}).classed("focused",!1).transition().duration(100).style("opacity",1)};k.show=function(a){d3.selectAll(Ma(a)).transition().style("opacity",1)};k.hide=function(a){d3.selectAll(Ma(a)).transition().style("opacity",0)};k.unzoom=function(){E.clear().update();z({withUpdateXDomain:!0})};k.load=function(a){u(a.done)&&(a.done=function(){});if("cacheIds"in a&&K(a.cacheIds))Ka(ab(a.cacheIds),
a.done);else if("data"in a)Ka(da(data),a.done);else if("url"in a)d3.csv(a.url,function(c,b){Ka(da(b),a.done)});else if("rows"in a)Ka(da(wa(a.rows)),a.done);else if("columns"in a)Ka(da(xa(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(c){return c.id!=a});d3.selectAll(".target-"+a).transition().style("opacity",0).remove();sa&&(d3.selectAll(".legend-item-"+a).remove(),$a(k.data.targets));0<k.data.targets.length&&
z()};k.selected=function(a){a=l(a)?"-"+a:"";return d3.merge(g.selectAll(".-shapes"+a).selectAll(".-shape").filter(function(){return d3.select(this).classed(ba)}).map(function(a){return a.map(function(a){return a.__data__})}))};k.select=function(a,c,b){$&&g.selectAll(".-shapes").selectAll(".-shape").each(function(e,f){var g="circle"===this.nodeName?Wb:Gc,h="circle"===this.nodeName?nb:Yb;0<=c.indexOf(f)?la(e)&&(ka||u(a)||0<=a.indexOf(e.id))&&g(d3.select(this).classed(ba,!0),e,f):l(b)&&b&&h(d3.select(this).classed(ba,
!1),e,f)})};k.unselect=function(a,b){$&&g.selectAll(".-shapes").selectAll(".-shape").each(function(d,e){var f="circle"===this.nodeName?nb:Yb;(u(b)||0<=b.indexOf(e))&&la(d)&&(ka||u(a)||0<=a.indexOf(d.id))&&f(d3.select(this).classed(ba,!1),d,e)})};k.toLine=function(a){lb(a,"line");z()};k.toSpline=function(a){lb(a,"spline");z()};k.toBar=function(a){lb(a,"bar");z()};k.groups=function(a){if(u(a))return q;q=a;z();return q};k.regions=function(a){if(u(a))return J;J=a;z();return J};k.regions.add=function(a){if(u(a))return J;
J=J.concat(a);z();return J};k.regions.remove=function(a,b){var d=[].concat(a);b=l(b)?b:{};d.forEach(function(a){var d=d3.selectAll("."+a);l(b.duration)&&(d=d.transition().duration(b.duration).style("fill-opacity",0));d.remove();J=J.filter(function(b){return 0>b.classes.indexOf(a)})});return J};k.data.get=function(a){a=k.data.getAsTarget(a);return l(a)?a.values.map(function(a){return a.value}):void 0};k.data.getAsTarget=function(a){var b=Ta(function(b){return b.id==a});return 0<b.length?b[0]:void 0};
if("url"in R.data)d3.csv(R.data.url,function(a,b){ob(b)});else if("rows"in R.data)ob(wa(R.data.rows));else if("columns"in R.data)ob(xa(R.data.columns));else throw Error("url or rows or columns is required.");wb.onresize=function(){N();S();E.x(V);ja&&F.x(m);d3.select("svg").attr("width",bb).attr("height",pa);d3.select("#"+pb).select("rect").attr("width",t).attr("height",s);d3.select("#xaxis-clip").select("rect").attr("width",t+2);d3.select(".zoom-rect").attr("width",t).attr("height",s);g.select(".x.axis").attr("transform",
I.x);g.select(".y2.axis").attr("transform",I.y2);qa&&(w.select(".x.brush").selectAll("rect").attr("height",fa),w.attr("transform",I.context),w.select(".x.axis").attr("transform",I.subx));sa&&(ra.attr("transform",I.legend),$a(k.data.targets,{withTransition:!1}));z({withTransition:!1,withUpdateXDomain:!0})};return k}})(window);

Loading…
Cancel
Save