Browse Source

Fix line with regions

pull/18/head
Masayuki Tanaka 11 years ago
parent
commit
a0b1f8d49a
  1. 2
      c3.js
  2. 6
      c3.min.js

2
c3.js

@ -795,7 +795,7 @@
var data = filterRemoveNull(d.values), x0, y0;
if (isLineType(d)) {
isSplineType(d) ? line.interpolate("cardinal") : line.interpolate("linear");
return Object.keys(__data_regions).length > 0 ? lineWithRegions(data, x, getYScale(d.id), __data_regions[d.id]) : line(data);
return __data_regions[d.id] ? lineWithRegions(data, x, getYScale(d.id), __data_regions[d.id]) : line(data);
} else {
x0 = x(data[0].x);
y0 = getYScale(d.id)(data[0].value);

6
c3.min.js vendored

@ -57,9 +57,9 @@ Oa=e(["axis","x","default"],null),dd=e(["axis","x","label"],null),Jc=e(["axis","
e+"</td><td class='value'>"+d+"</td></tr>";return b+"</table>"}),id=e(["tooltip","init","show"],!1),za=e(["tooltip","init","x"],0),sc=e(["tooltip","init","position"],{top:"0px",left:"50px"}),xb=ua.replace("#","")+"-clip",Na="url(#"+xb+")",z="timeseries"===vc,ca="categorized"===vc,ob=!z&&V,Cb=null,fb=!1,Bb=!1,la=ya?40:0,oa=d.time.format(pd).parse,W=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]}}(qd,rd),Ec=function(){var a=[[d.time.format("%Y/%-m/%-d"),function(){return!0}],[d.time.format("%-m/%-d"),function(a){return a.getMonth()}],[d.time.format("%-m/%-d"),function(a){return 1!==a.getDate()}],[d.time.format("%-m/%-d"),function(a){return a.getDay()&&1!==a.getDate()}],[d.time.format("%I %p"),function(a){return a.getHours()}],[d.time.format("%I:%M"),function(a){return a.getMinutes()}],[d.time.format(":%S"),function(a){return a.getSeconds()}],
[d.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)}}(),Ib,Pb,Kb,Va,Ob,Qb,r,u,ma,ib,ta,Sb,Tb,lb,mb,l,y,T,ba,Wa,Xa,J,na,Ya,Da,zc=f?"left":"bottom",Ac=f?kb?"top":"bottom":kb?"right":"left",Bc=f?jb?"bottom":"top":jb?"left":"right",Cc="bottom",K={main:function(){return"translate("+A+","+q+")"},context:function(){return"translate("+m+","+Aa+")"},legend:function(){return"translate("+Gb+","+Fb+")"},y2:function(){return"translate("+
(f?0:r)+","+(f?10:0)+")"},x:function(){return"translate(0,"+u+")"},subx:function(){return"translate(0,"+ma+")"}},ld=function(){var a=d.svg.line().x(f?function(a){return D(a.id)(a.value)}:cb).y(f?cb:function(a){return D(a.id)(a.value)});return function(b){var c=lc(b.values),d;if(ub(b))return"spline"===fa["string"===typeof b?b:b.id]?a.interpolate("cardinal"):a.interpolate("linear"),0<Object.keys(uc).length?Xc(c,l,D(b.id),uc[b.id]):a(c);d=l(c[0].x);b=D(b.id)(c[0].value);return f?"M "+b+" "+d:"M "+d+
" "+b}}(),md=function(){var a=d.svg.line().x(function(a){return ba(a.x)}).y(function(a){return R(a.id)(a.value)});return function(b){var c=lc(b.values);return ub(b)?a(c):"M "+ba(c[0].x)+" "+R(b.id)(c[0].value)}}(),F=d.svg.brush().on("brush",function(){B({withTransition:!1,withY:!1,withSubchart:!1,withUpdateXDomain:!0})}),G=d.behavior.zoom().on("zoomstart",function(){G.altDomain=d.event.sourceEvent.altKey?l.orgDomain():null}).on("zoom",pa?nd:null);F.update=function(){x&&x.select(".x.brush").call(this);
return this};G.orgScaleExtent=function(){var a=tc?tc:[1,10];return[a[0],Math.max(va()/a[1],a[1])]};G.updateScaleExtent=function(){var a=l.orgDomain(),a=(a[1]-a[0])/(U[1]-U[0]),b=this.orgScaleExtent();this.scaleExtent([b[0]*a,b[1]*a]);return this};var Ma,eb,h,x,xa,X,db,bb=null,pb=null,U;g.focus=function(a){g.defocus();d.selectAll(Ra(a)).filter(function(a){return rb(a.id)}).classed("focused",!0).transition().duration(100).style("opacity",1)};g.defocus=function(a){d.selectAll(Ra(a)).filter(function(a){return rb(a.id)}).classed("focused",
(f?0:r)+","+(f?10:0)+")"},x:function(){return"translate(0,"+u+")"},subx:function(){return"translate(0,"+ma+")"}},ld=function(){var a=d.svg.line().x(f?function(a){return D(a.id)(a.value)}:cb).y(f?cb:function(a){return D(a.id)(a.value)});return function(b){var c=lc(b.values),d;if(ub(b))return"spline"===fa["string"===typeof b?b:b.id]?a.interpolate("cardinal"):a.interpolate("linear"),uc[b.id]?Xc(c,l,D(b.id),uc[b.id]):a(c);d=l(c[0].x);b=D(b.id)(c[0].value);return f?"M "+b+" "+d:"M "+d+" "+b}}(),md=function(){var a=
d.svg.line().x(function(a){return ba(a.x)}).y(function(a){return R(a.id)(a.value)});return function(b){var c=lc(b.values);return ub(b)?a(c):"M "+ba(c[0].x)+" "+R(b.id)(c[0].value)}}(),F=d.svg.brush().on("brush",function(){B({withTransition:!1,withY:!1,withSubchart:!1,withUpdateXDomain:!0})}),G=d.behavior.zoom().on("zoomstart",function(){G.altDomain=d.event.sourceEvent.altKey?l.orgDomain():null}).on("zoom",pa?nd:null);F.update=function(){x&&x.select(".x.brush").call(this);return this};G.orgScaleExtent=
function(){var a=tc?tc:[1,10];return[a[0],Math.max(va()/a[1],a[1])]};G.updateScaleExtent=function(){var a=l.orgDomain(),a=(a[1]-a[0])/(U[1]-U[0]),b=this.orgScaleExtent();this.scaleExtent([b[0]*a,b[1]*a]);return this};var Ma,eb,h,x,xa,X,db,bb=null,pb=null,U;g.focus=function(a){g.defocus();d.selectAll(Ra(a)).filter(function(a){return rb(a.id)}).classed("focused",!0).transition().duration(100).style("opacity",1)};g.defocus=function(a){d.selectAll(Ra(a)).filter(function(a){return rb(a.id)}).classed("focused",
!1).transition().duration(100).style("opacity",0.3)};g.revert=function(a){d.selectAll(Ra(a)).filter(function(a){return rb(a.id)}).classed("focused",!1).transition().duration(100).style("opacity",1)};g.show=function(a){d.selectAll(Ra(a)).transition().style("opacity",1)};g.hide=function(a){d.selectAll(Ra(a)).transition().style("opacity",0)};g.unzoom=function(){F.clear().update();B({withUpdateXDomain:!0})};g.load=function(a){t(a.done)&&(a.done=function(){});"categories"in a&&ca&&(Ea=a.categories,J.categories(Ea));
if("cacheIds"in a&&Sa(a.cacheIds))Pa(Ta(a.cacheIds),a.done);else if("data"in a)Pa(Ja(a.data),a.done);else if("url"in a)d.csv(a.url,function(b,c){Pa(Ja(c),a.done)});else if("rows"in a)Pa(Ja(Wb(a.rows)),a.done);else if("columns"in a)Pa(Ja(Xb(a.columns)),a.done);else throw Error("url or rows or columns is required.");};g.unload=function(a){g.data.targets=g.data.targets.filter(function(b){return b.id!==a});d.selectAll(".target-"+a).transition().style("opacity",0).remove();ya&&(d.selectAll(".legend-item-"+
a).remove(),gb(g.data.targets));0<g.data.targets.length&&B()};g.selected=function(a){a=n(a)?"-"+a:"";return d.merge(h.selectAll(".-shapes"+a).selectAll(".-shape").filter(function(){return d.select(this).classed(ia)}).map(function(a){return a.map(function(a){return a.__data__})}))};g.select=function(a,b,c){ga&&h.selectAll(".-shapes").selectAll(".-shape").each(function(e,f){var g="circle"===this.nodeName?hc:Wc,h="circle"===this.nodeName?vb:jc;0<=b.indexOf(f)?ra(e)&&(qa||t(a)||0<=a.indexOf(e.id))&&g(d.select(this).classed(ia,

Loading…
Cancel
Save