Browse Source

Fix tick format bug

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

2
c3.js

@ -350,7 +350,7 @@
return id in __data_axes ? __data_axes[id] : 'y';
}
function getXAxisTickFormat() {
var tickFormat = isTimeSeries ? defaultTimeFormat : isCategorized ? category : null;
var tickFormat = isTimeSeries ? defaultTimeFormat : isCategorized ? category : function (x) { return x; };
if (__axis_x_tick_format) {
tickFormat = typeof __axis_x_tick_format === 'function' ? __axis_x_tick_format : isTimeSeries ? function (date) { return d3.time.format(__axis_x_tick_format)(date); } : tickFormat;
}

2
c3.min.js vendored

@ -6,7 +6,7 @@ aa=e in{top:1,right:1,bottom:1,left:1}?e+"":"bottom";return m};m.categories=func
O.c3={},e=O.d3;hb.generate=function(Y){var Fb,Gb,Aa,Ba,m,p,aa,E,A;function c(a,b){for(var d=Y,k=0;k<a.length;k++){if(!(a[k]in d))return b;d=d[a[k]]}return d}function sa(){ib=null===Ua?Z():Ua;ta=S();Ib=20+Jb+la;Kb=Lb?Lb:Mb?jb||f?1:40:20;Va=Nb?Nb:kb?1:40;Ob=ta-Jb-la;Pb=20+la;Qb=ta-la;p=0;aa=Kb;E=Ib;A=Va;Aa=Ob;Ba=Pb;m=Va;Fb=Qb;Gb=Va;r=ib-A-aa;u=ta-p-E;ma=ta-Aa-Ba}function S(){var a=null===Rb?+e.select(ua).style("height").replace("px",""):Rb;return 0<a?a:320}function Z(){return+e.select(ua).style("width").replace("px",
"")}function Q(){return r+2+A+aa}function P(){return 40}function ja(){return A+20}function hb(){return u-p+42}function Eb(){Sb=f?10:0;Tb=f?u:r;lb=f?0:u;mb=f?r:1;l=H(Sb,Tb,n(l)?l.domain():void 0,function(){return J.tickOffset()});y=C(lb,mb,n(y)?y.domain():void 0);T=C(lb,mb,n(T)?T.domain():void 0);ba=H(0,r,n(U)?U:void 0,function(a){return 0===a%1?Da.tickOffset():0});Wa=C(ma,10);Xa=C(ma,10);J=M(l,zc);na=e.svg.axis().scale(y).orient(Ac);Ya=e.svg.axis().scale(T).orient(Bc);Da=M(ba,Cc)}function H(a,b,d,
k){var q=(z?e.time.scale():e.scale.linear()).range([a,b]);q.orgDomain=function(){return q.domain()};n(d)&&q.domain(d);t(k)&&(k=function(){return 0});if(ca){var c=q,s,q=function(a){return c(a)+k(a)};for(s in c)q[s]=c[s];q.orgDomain=function(){return c.domain()};q.domain=function(a){if(!arguments.length)return a=c.domain(),[a[0],a[1]+1];c.domain(a);return q}}return q}function C(a,b){return e.scale.linear().range([a,b])}function D(a){return"y2"===N(a)?T:y}function R(a){return"y2"===N(a)?Xa:Wa}function M(a,
b){var d=(ca?wc():e.svg.axis()).scale(a).orient(b);d.tickFormat(I());ca?d.categories(Ea).tickCentered(Dc):d.tickOffset=function(){return 0};return d}function N(a){return a in Ub?Ub[a]:"y"}function I(){var a=z?Ec:ca?Fc:null;Za&&(a="function"===typeof Za?Za:z?function(a){return e.time.format(Za)(a)}:a);return a}function xc(a){return e.min(a,function(a){return e.min(a.values,function(a){return a.value})})}function yc(a){var b={},d,k;a.forEach(function(a){b[a.id]=[];a.values.forEach(function(d){b[a.id].push(d.value)})});
b){var d=(ca?wc():e.svg.axis()).scale(a).orient(b);d.tickFormat(I());ca?d.categories(Ea).tickCentered(Dc):d.tickOffset=function(){return 0};return d}function N(a){return a in Ub?Ub[a]:"y"}function I(){var a=z?Ec:ca?Fc:function(a){return a};Za&&(a="function"===typeof Za?Za:z?function(a){return e.time.format(Za)(a)}:a);return a}function xc(a){return e.min(a,function(a){return e.min(a.values,function(a){return a.value})})}function yc(a){var b={},d,k;a.forEach(function(a){b[a.id]=[];a.values.forEach(function(d){b[a.id].push(d.value)})});
for(d=0;d<w.length;d++)for(k=1;k<w[d].length;k++)Fa(w[d][k])&&(t(b[w[d][k]])||b[w[d][k]].forEach(function(a,e){N(w[d][k])===N(w[d][0])&&(b[w[d][0]][e]+=1*a)}));return e.max(Object.keys(b).map(function(a){return e.max(b[a])}))}function ka(a){var b=$a(function(b){return N(b.id)===a}),d="y2"===a?Gc:Hc,k="y2"===a?Ic:Jc,d=null!==d?d:xc(b),k=null!==k?k:yc(b),q=0.1*Math.abs(k-d),e=q,c=q,f="y2"===a?Kc:Lc;null!==f&&(d=Math.max(Math.abs(d),Math.abs(k)),k=d-f,d=f-d);"y"===a&&null!==Ga&&(e=n(Ga.top)?Ga.top:q,
c=n(Ga.bottom)?Ga.bottom:q);"y2"===a&&null!==Ha&&(e=n(Ha.top)?Ha.top:q,c=n(Ha.bottom)?Ha.bottom:q);return[Mc(b,"bar")?0:d-c,k+e]}function $(a){var b;a?(a=l.domain(),b=F.extent()):(a=U,b=l.domain());return(a[1]-a[0])/(b[1]-b[0])}function Sa(a){for(var b=0;b<a.length;b++)if(!(a[b]in ab))return!1;return!0}function Ta(a){for(var b=[],d=0;d<a.length;d++)a[d]in ab&&b.push(Vb(ab[a[d]]));return b}function Ca(a){return"start"in a?l(z?oa(a.start):a.start):0}function Hb(a){var b=Ca(a);a=("end"in a?l(z?oa(a.end):
a.end):r)-b;return 0>a?0:a}function nb(a){var b=Ia[a.id];a.name=n(b)?b:a.id;return a}function Wb(a){var b=a[0],d={},k=[],e,c;for(e=1;e<a.length;e++){d={};for(c=0;c<a[e].length;c++)d[b[c]]=a[e][c];k.push(d)}return k}function Xb(a){var b=[],d,k,e;for(d=0;d<a.length;d++)for(e=a[d][0],k=1;k<a[d].length;k++)t(b[k-1])&&(b[k-1]={}),b[k-1][e]=a[d][k];return b}function Ja(a){var b=e.keys(a[0]).filter(function(a){return a!==V}),d,k;if(z&&!V)return O.alert('data.x must be specified when axis.x.type == "timeseries"'),

Loading…
Cancel
Save