Browse Source

Fix number conversion for x

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

2
c3.js

@ -714,7 +714,7 @@
x = parseDate(d[xKey]);
}
else if (isCustomX) {
x = d[xKey] ? d[xKey] : getXValue(id, i);
x = d[xKey] ? +d[xKey] : getXValue(id, i);
}
else {
x = i;

2
c3.min.js vendored

@ -14,7 +14,7 @@ lb);n.selectAll(".-arc").style("opacity",1)}function Hd(a){var b=Ac(a),c,d,f,I;i
Oa.bottom:f);ja(b,"bar")&&!Bc(b)&&(g=c);return[c-g,d+e]}function Qd(a){return e.min(a,function(a){return e.min(a.values,function(a){return a.x})})}function Rd(a){return e.max(a,function(a){return e.max(a.values,function(a){return a.x})})}function pb(a){var b=[Qd(a),Rd(a)];a=b[0];var b=b[1],c=ka?0:0.01*Math.abs(a-b);a=E?new Date(a.getTime()-c):a-c;b=E?new Date(b.getTime()+c):b+c;return[a,b]}function za(a){return a[1]-a[0]}function Sd(a){for(var b=0;b<a.length;b++)if(!(a[b]in qb))return!1;return!0}
function Td(a){for(var b=[],c=0;c<a.length;c++)a[c]in qb&&b.push(Cc(qb[a[c]]));return b}function Sb(a){return"start"in a?m(E?ra(a.start):a.start):0}function Dc(a){var b=Sb(a);a=("end"in a?m(E?ra(a.end):a.end):r)-b;return 0>a?0:a}function Ec(a){return sa&&a===sa||ca&&Ud(ca,a)}function Vd(a){return!Ec(a)}function Wd(a){Object.keys(a).forEach(function(b){ca[b]=a[b]})}function rb(a){var b;a&&(b=Pa[a.id],a.name=b?b:a.id);return a}function Fc(a){var b=a[0],c={},d=[],f,e;for(f=1;f<a.length;f++){c={};for(e=
0;e<a[f].length;e++)c[b[e]]=a[f][e];d.push(c)}return d}function Gc(a){var b=[],c,d,f;for(c=0;c<a.length;c++)for(f=a[c][0],d=1;d<a[c].length;d++)y(b[d-1])&&(b[d-1]={}),b[d-1][f]=a[c][d];return b}function Qa(a){var b=e.keys(a[0]).filter(Vd),c=e.keys(a[0]).filter(Ec);if(E&&0===c.length)return P.alert('data.x or data.xs must be specified when axis.x.type == "timeseries"'),[];Tb&&b.forEach(function(b){var f=sa?sa:ca?ca[b]:null;0<=c.indexOf(f)?k.data.x[b]=a.map(function(a){return a[f]}):k.data.x[b]=k.data.x[Object.keys(k.data.x)[0]]});
b=b.map(function(b){var c=Xd(b);return{id:c,id_org:b,values:a.map(function(a,e){var g;g=sa?sa:ca?ca[b]:null;g=E?ra(a[g]):Tb?a[g]?a[g]:b in k.data.x&&k.data.x[b]&&k.data.x[b][e]?k.data.x[b][e]:e:e;a.x=g;return{x:g,value:null===a[b]||isNaN(a[b])?null:+a[b],id:c}})}});b.forEach(function(a){var b;a.values=a.values.sort(function(a,b){return(a.x||0===a.x?a.x:Infinity)-(b.x||0===b.x?b.x:Infinity)});b=0;a.values.forEach(function(a){a.index=b++})});Hc&&da(Ra(b).filter(function(a){return!(a in B)}),Hc);b.forEach(function(a){qb[a.id_org]=
b=b.map(function(b){var c=Xd(b);return{id:c,id_org:b,values:a.map(function(a,e){var g;g=sa?sa:ca?ca[b]:null;g=E?ra(a[g]):Tb?a[g]?+a[g]:b in k.data.x&&k.data.x[b]&&k.data.x[b][e]?k.data.x[b][e]:e:e;a.x=g;return{x:g,value:null===a[b]||isNaN(a[b])?null:+a[b],id:c}})}});b.forEach(function(a){var b;a.values=a.values.sort(function(a,b){return(a.x||0===a.x?a.x:Infinity)-(b.x||0===b.x?b.x:Infinity)});b=0;a.values.forEach(function(a){a.index=b++})});Hc&&da(Ra(b).filter(function(a){return!(a in B)}),Hc);b.forEach(function(a){qb[a.id_org]=
Cc(a)});return b}function Cc(a){return{id:a.id,id_org:a.id_org,values:a.values.map(function(a){return{x:a.x,value:a.value,id:a.id}})}}function Ic(a){return 0<a&&k.data.targets[0].values[a-1]?k.data.targets[0].values[a-1].x:void 0}function gb(){return e.max(k.data.targets,function(a){return a.values.length})}function Yd(){var a=k.data.targets.length,b=0,c;1<a?k.data.targets.forEach(function(a){a.values.length>b&&(c=a,b=a.values.length)}):c=a?k.data.targets[0]:null;return c}function Ra(a){a=y(a)?k.data.targets:
a;return a.map(function(a){return a.id})}function Jc(a){var b=Ra(),c;for(c=0;c<b.length;c++)if(b[c]===a)return!0;return!1}function ob(a){return v(a)?k.data.targets.filter(a):k.data.targets}function Ac(a){var b={};a.forEach(function(a){b[a.id]=[];a.values.forEach(function(d){b[a.id].push(d.value)})});return b}function Kc(a,b){var c=Object.keys(a),d,f,e;for(d=0;d<c.length;d++)for(e=a[c[d]].values,f=0;f<e.length;f++)if(b(e[f].value))return!0;return!1}function Bc(a){return Kc(a,function(a){return 0>a})}
function Jd(a){return Kc(a,function(a){return 0<a})}function Fd(a){return a<Ma.length?Ma[a]:a}function Sa(a){return"-shapes -shapes-"+a.id}function Lc(a){return Sa(a)+" -line -line-"+a.id}function Zd(a){return Sa(a)+" -circles -circles-"+a.id}function Mc(a){return Sa(a)+" -bars -bars-"+a.id}function $d(a){return Sa(a.data)+" -arc -arc-"+a.data.id}function ae(a){return Sa(a)+" -area -area-"+a.id}function be(a,b){return"-shape -shape-"+b+" -circle -circle-"+b}function Nc(a,b){return"-shape -shape-"+

Loading…
Cancel
Save