Browse Source

Update c3.min.js

pull/43/head
Masayuki Tanaka 11 years ago
parent
commit
fe184c507e
  1. 10
      c3.min.js

10
c3.min.js vendored

@ -32,12 +32,12 @@ b){return Math.pow(m(a.x)-b[0],2)+Math.pow(z(a.value)-b[1],2)}function cd(a,b,c)
c(l(f+e))};for(f=0;f<a.length;f++)if(y(ra)||!ie(a[f].x,ra))g+=" "+hd(a[f])+" "+n(a[f]);else{k=ha(a[f-1].x,a[f].x);l=I(a[f-1].value,a[f].value);e=b(a[f].x)-b(a[f-1].x);m=c(a[f].value)-c(a[f-1].value);e=Math.sqrt(Math.pow(e,2)+Math.pow(m,2));m=2/e;var p=2*m;for(e=m;1>=e;e+=p)g+=d(a[f-1],a[f],e,m)}return g}function ac(a){var b;tb=e.select(wa);if(tb.empty())O.alert('No bind element found. Check the selector specified by "bindto" and existance of that element. Default "bindto" is "#chart".');else{tb.html("");
k.data.x={};k.data.targets=Pa(a);ua();Y();m.domain(e.extent(pb(k.data.targets)));z.domain(nb("y"));aa.domain(nb("y2"));U.domain(m.domain());ib.domain(z.domain());jb.domain(aa.domain());J.ticks(10>a.length?a.length:10);ya.ticks(ne).outerTickSize(0).tickFormat(bc);kb.ticks(oe).outerTickSize(0).tickFormat(pe);T=m.domain();K.scale(U);sa&&F.scale(m);n=e.select(wa).append("svg").attr("width",r+C+$).attr("height",s+q+M).on("mouseenter",qe).on("mouseleave",re);ub=n.append("defs");ub.append("clipPath").attr("id",
cc).append("rect").attr("y",q).attr("width",r).attr("height",s-q);ub.append("clipPath").attr("id","xaxis-clip").append("rect").attr("x",-1-C).attr("y",-20).attr("width",W).attr("height",na);ub.append("clipPath").attr("id","yaxis-clip").append("rect").attr("x",-C+1).attr("y",q-1).attr("width",zb).attr("height",wd);l=n.append("g").attr("transform",L.main);G=Ca?n.append("g").attr("transform",L.context):null;Da=Ea?n.append("g").attr("transform",L.legend):null;V=e.select(wa).style("position","relative").append("div").style("position",
"absolute").style("z-index","10").style("display","none");l.append("g").attr("class","x axis").attr("clip-path",h?"":"url(#xaxis-clip)").attr("transform",L.x).call(h?ya:J).append("text").attr("class","-axis-x-label").attr("x",r).attr("dy","-.5em").style("text-anchor","end").text(se);l.append("g").attr("class","y axis").attr("clip-path",h?"url(#yaxis-clip)":"").call(h?J:ya).append("text").attr("transform","rotate(-90)").attr("dy","1.2em").attr("dx","-.5em").style("text-anchor","end").text(te);Cb&&
l.append("g").attr("class","y2 axis").attr("transform",L.y2).call(kb);a=l.append("g").attr("clip-path",Wa).attr("class","grid");id&&a.append("g").attr("class","xgrids");dc&&(b=a.append("g").attr("class","xgrid-lines").selectAll(".xgrid-line").data(dc).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",h?"":"rotate(-90)").attr("dx",h?
0:-q).attr("dy",-5).text(function(a){return a.text}));ue&&a.append("g").attr("class","xgrid-focus").append("line").attr("class","xgrid-focus").attr("x1",h?0:-10).attr("x2",h?r:-10).attr("y1",h?-10:q).attr("y2",h?-10:s);jd&&a.append("g").attr("class","ygrids");ec&&(a=a.append("g").attr("class","ygrid-lines").selectAll("ygrid-line").data(ec).enter().append("g").attr("class","ygrid-line"),a.append("line").attr("class",function(a){return""+a["class"]}),a.append("text").attr("class",function(a){return""+
"absolute").style("z-index","10").style("display","none");l.append("g").attr("class","x axis").attr("clip-path",h?"":"url("+document.URL+"#xaxis-clip)").attr("transform",L.x).call(h?ya:J).append("text").attr("class","-axis-x-label").attr("x",r).attr("dy","-.5em").style("text-anchor","end").text(se);l.append("g").attr("class","y axis").attr("clip-path",h?"url("+document.URL+"#yaxis-clip)":"").call(h?J:ya).append("text").attr("transform","rotate(-90)").attr("dy","1.2em").attr("dx","-.5em").style("text-anchor",
"end").text(te);Cb&&l.append("g").attr("class","y2 axis").attr("transform",L.y2).call(kb);a=l.append("g").attr("clip-path",Wa).attr("class","grid");id&&a.append("g").attr("class","xgrids");dc&&(b=a.append("g").attr("class","xgrid-lines").selectAll(".xgrid-line").data(dc).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",h?"":"rotate(-90)").attr("dx",
h?0:-q).attr("dy",-5).text(function(a){return a.text}));ue&&a.append("g").attr("class","xgrid-focus").append("line").attr("class","xgrid-focus").attr("x1",h?0:-10).attr("x2",h?r:-10).attr("y1",h?-10:q).attr("y2",h?-10:s);jd&&a.append("g").attr("class","ygrids");ec&&(a=a.append("g").attr("class","ygrid-lines").selectAll("ygrid-line").data(ec).enter().append("g").attr("class","ygrid-line"),a.append("line").attr("class",function(a){return""+a["class"]}),a.append("text").attr("class",function(a){return""+
a["class"]}).attr("text-anchor","end").attr("transform",h?"rotate(-90)":"").attr("dx",h?0:-q).attr("dy",-5).text(function(a){return a.text}));l.append("g").attr("clip-path",Wa).attr("class","regions");l.append("g").attr("clip-path",Wa).attr("class","chart");l.select(".chart").append("g").attr("class","event-rects").style("fill-opacity",0).style("cursor",sa?h?"ns-resize":"ew-resize":null);l.select(".chart").append("g").attr("class","chart-bars");l.select(".chart").append("g").attr("class","chart-lines");
l.select(".chart").append("g").attr("class","chart-arcs").attr("transform",L.arc).append("text").attr("class","chart-arcs-title").style("text-anchor","middle").text(ve);if(sa)l.insert("rect",we?null:"g.grid").attr("class","zoom-rect").attr("width",r).attr("height",s).style("opacity",0).style("cursor",h?"ns-resize":"ew-resize").call(F).on("dblclick.zoom",null);null!==vb&&K.extent("function"!==typeof vb?vb:vb(pb()));Ca&&(G.append("g").attr("clip-path",Wa).attr("class","chart"),G.select(".chart").append("g").attr("class",
"chart-bars"),G.select(".chart").append("g").attr("class","chart-lines"),G.append("g").attr("clip-path",Wa).attr("class","x brush").call(K).selectAll("rect").attr(h?"width":"height",h?Db:fb),G.append("g").attr("class","x axis").attr("transform",L.subx).attr("clip-path",h?"url(#yaxis-clip)":"").call(hb));Ea&&wb(k.data.targets);kd(k.data.targets);x({withTransform:!0,withUpdateXDomain:!0});if(xe){if(D&&"string"===typeof Fa){Fa=pa(Fa);for(a=0;a<k.data.targets[0].values.length&&0!==k.data.targets[0].values[a].x-
"chart-bars"),G.select(".chart").append("g").attr("class","chart-lines"),G.append("g").attr("clip-path",Wa).attr("class","x brush").call(K).selectAll("rect").attr(h?"width":"height",h?Db:fb),G.append("g").attr("class","x axis").attr("transform",L.subx).attr("clip-path",h?"url("+document.URL+"#yaxis-clip)":"").call(hb));Ea&&wb(k.data.targets);kd(k.data.targets);x({withTransform:!0,withUpdateXDomain:!0});if(xe){if(D&&"string"===typeof Fa){Fa=pa(Fa);for(a=0;a<k.data.targets[0].values.length&&0!==k.data.targets[0].values[a].x-
Fa;a++);Fa=a}V.html(Vc(k.data.targets.map(function(a){return rb(a.values[Fa])})));V.style("top",ld.top).style("left",ld.left).style("display","block")}null==O.onresize&&(O.onresize=ye());O.onresize.add&&O.onresize.add(md)}}function ze(a){a.append("rect").attr("class",Mc).style("cursor",ka&&ta?"pointer":null).on("mouseover",function(a,c){if(!Xa&&!E(k.data.targets)){var d=k.data.targets.map(function(a){return rb(a.values[c])}),f,e;if(0<Object.keys(Oa).length){e=[];for(var g in Oa)for(f=0;f<d.length;f++)if(d[f].id===
g){e.push(d[f]);d.shift(f);break}d=e.concat(d)}fc&&Yb(c,void 0).classed(da,!0).attr("r",gc);gd(c).classed(da,!1);Wc(d[0])}}).on("mouseout",function(a,c){E(k.data.targets)||(Xc(),V.style("display","none"),Zb(c),gd(void 0).classed(da,!1))}).on("mousemove",function(a,c){var d;Xa||E(k.data.targets)||(d=k.data.targets.map(function(a){return rb(a.values[c])}),Tc(d,e.mouse(this)),ka&&(ta||l.selectAll(".-shape-"+c).filter(function(a){return la(a)}).each(function(){var a=e.select(this).classed(da,!0);"circle"===
this.nodeName&&a.attr("r",gc);n.select(".event-rect-"+c).style("cursor",null)}).filter(function(){var a=e.select(this);if("circle"===this.nodeName)return ad(this,Va);if("rect"===this.nodeName)return bd(this,a.attr("x"),a.attr("y"))}).each(function(){var a=e.select(this);a.classed(da)||(a.classed(da,!0),"circle"===this.nodeName&&a.attr("r",Va));n.select(".event-rect-"+c).style("cursor","pointer")})))}).on("click",function(a,c){E(k.data.targets)||(hc?hc=!1:l.selectAll(".-shape-"+c).each(function(a){nd(this,
@ -72,7 +72,7 @@ function(){}),Ce=g(["transition","duration"],350);if(!("data"in ea))throw Error(
null),Md=g(["axis","y","max"],null),Kd=g(["axis","y","min"],null),Od=g(["axis","y","center"],null),te=g(["axis","y","label"],null),cb=g(["axis","y","inner"],!1),bc=g(["axis","y","tick","format"],null),Ma=g(["axis","y","padding"],null),ne=g(["axis","y","ticks"],10),Cb=g(["axis","y2","show"],!1),Ld=g(["axis","y2","max"],null),Jd=g(["axis","y2","min"],null),Nd=g(["axis","y2","center"],null),eb=g(["axis","y2","inner"],!1),pe=g(["axis","y2","tick","format"],null),Na=g(["axis","y2","padding"],null),oe=
g(["axis","y2","ticks"],10),h=g(["axis","rotated"],!1),id=g(["grid","x","show"],!1),De=g(["grid","x","type"],"tick"),dc=g(["grid","x","lines"],null),jd=g(["grid","y","show"],!1),ec=g(["grid","y","lines"],null),$b=g(["point","show"],!0)?g(["point","r"],2.5):0,ue=g(["point","focus","line","enabled"],!0),fc=g(["point","focus","expand","enabled"],!0),gc=g(["point","focus","expand","r"],fc?4:$b),Va=g(["point","focus","select","r"],8),Be=g(["point","onclick"],function(){}),je=g(["point","onselected"],function(){}),
ke=g(["point","onunselected"],function(){}),Fd=g(["arc","label","format"],function(a,b){return(100*b).toFixed(1)+"%"}),ve=g(["arc","title"],""),P=g(["regions"],[]),Uc=g(["tooltip","enabled"],!0),Vc=g(["tooltip","contents"],function(a){var b="<table class='-tooltip'><tr><th colspan='2'>"+rc()(a[0].x)+"</th></tr>",c,d,e,g=bc?bc:function(a){return+a};for(c=0;c<a.length;c++)if(a[c]&&(a[c].value||0===a[c].value)){d="-";if(a[c].value||0===a[c].value)d=g(a[c].value);e=a[c].name;b+="<tr class='-tooltip-name-"+
a[c].id+"'><td class='name'><span style='background-color:"+N(a[c].id)+"'></span>"+e+"</td><td class='value'>"+d+"</td></tr>"}return b+"</table>"}),xe=g(["tooltip","init","show"],!1),Fa=g(["tooltip","init","x"],0),ld=g(["tooltip","init","position"],{top:"0px",left:"50px"}),cc=wa.replace("#","")+"-clip",Wa="url(#"+cc+")",D="timeseries"===ud,ja="categorized"===ud,Rb=!D&&(qa||ba),ic=null,Xa=!1,hc=!1,oa=Ea?40:0,N=function(a,b){var c=[],d=null!==b?b:"#1f77b4 #ff7f0e #2ca02c #d62728 #9467bd #8c564b #e377c2 #7f7f7f #bcbd22 #17becf".split(" ");
a[c].id+"'><td class='name'><span style='background-color:"+N(a[c].id)+"'></span>"+e+"</td><td class='value'>"+d+"</td></tr>"}return b+"</table>"}),xe=g(["tooltip","init","show"],!1),Fa=g(["tooltip","init","x"],0),ld=g(["tooltip","init","position"],{top:"0px",left:"50px"}),cc=wa.replace("#","")+"-clip",Wa="url("+document.URL+"#"+cc+")",D="timeseries"===ud,ja="categorized"===ud,Rb=!D&&(qa||ba),ic=null,Xa=!1,hc=!1,oa=Ea?40:0,N=function(a,b){var c=[],d=null!==b?b:"#1f77b4 #ff7f0e #2ca02c #d62728 #9467bd #8c564b #e377c2 #7f7f7f #bcbd22 #17becf".split(" ");
return function(b){if(b in a)return a[b];-1===c.indexOf(b)&&c.push(b);return d[c.indexOf(b)%d.length]}}(Ke,Le),Dd=function(){var a=[[e.time.format("%Y/%-m/%-d"),function(){return!0}],[e.time.format("%-m/%-d"),function(a){return a.getMonth()}],[e.time.format("%-m/%-d"),function(a){return 1!==a.getDate()}],[e.time.format("%-m/%-d"),function(a){return a.getDay()&&1!==a.getDate()}],[e.time.format("%I %p"),function(a){return a.getHours()}],[e.time.format("%I:%M"),function(a){return a.getMinutes()}],[e.time.format(":%S"),
function(a){return a.getSeconds()}],[e.time.format(".%L"),function(a){return a.getMilliseconds()}]];return function(b){for(var c=a.length-1,d=a[c];!d[1](b);)d=a[--c];return d[0](b)}}(),r,Db,s,fb,Ab,va,Ka,Eb,Fb,lb,uc,vc,Nb,Hb,Ib,Jb,Kb,Lb,Mb,m,z,aa,U,ib,jb,J,ya,kb,hb,yd=h?"left":"bottom",zd=h?cb?"top":"bottom":cb?"right":"left",Ad=h?eb?"bottom":"top":eb?"left":"right",Bd=h?"left":"bottom",L={main:function(){return"translate("+C+","+q+")"},context:function(){return"translate("+Ha+","+Ga+")"},legend:function(){return"translate("+
pc+","+oc+")"},y2:function(){return"translate("+(h?0:r)+","+(h?10:0)+")"},x:function(){return"translate(0,"+s+")"},subx:function(){return"translate(0,"+(h?0:fb)+")"},arc:function(){return"translate("+r/2+","+s/2+")"}},tc=40,sc=20;Nb=e.layout.pie().value(function(a){return a.values.reduce(function(a,c){return a+c.value},0)});var Ee=function(){var a=e.svg.line().x(h?function(a){return v(a.id)(a.value)}:za).y(h?za:function(a){return v(a.id)(a.value)});return function(b){var c=Xb(b.values),d;if(Ub(b))return Yc(b)?

Loading…
Cancel
Save