recharts-scale
Advanced tools
Comparing version 0.3.0 to 0.3.1
@@ -0,1 +1,7 @@ | ||
## 0.3.1 (Jun 11, 2017) | ||
### fix | ||
- fix `getDigitCount` when the number is a scientific notation | ||
## 0.3.0 (Mar 01, 2017) | ||
@@ -2,0 +8,0 @@ |
@@ -40,9 +40,4 @@ 'use strict'; | ||
result = 1; | ||
} else if (abs < 1) { | ||
} else { | ||
result = Math.floor(Math.log(abs) / Math.log(10)) + 1; | ||
} else { | ||
var str = '' + value; | ||
var ary = str.split('.'); | ||
result = ary[0].length; | ||
} | ||
@@ -49,0 +44,0 @@ |
@@ -40,9 +40,4 @@ 'use strict'; | ||
result = 1; | ||
} else if (abs < 1) { | ||
} else { | ||
result = Math.floor(Math.log(abs) / Math.log(10)) + 1; | ||
} else { | ||
var str = '' + value; | ||
var ary = str.split('.'); | ||
result = ary[0].length; | ||
} | ||
@@ -49,0 +44,0 @@ |
{ | ||
"name": "recharts-scale", | ||
"version": "0.3.0", | ||
"version": "0.3.1", | ||
"description": "Scale of Cartesian Coordinates", | ||
@@ -5,0 +5,0 @@ "main": "lib/index", |
@@ -33,9 +33,4 @@ /** | ||
result = 1; | ||
} else if (abs < 1) { | ||
} else { | ||
result = Math.floor(Math.log(abs) / Math.log(10)) + 1; | ||
} else { | ||
const str = `${value}`; | ||
const ary = str.split('.'); | ||
result = ary[0].length; | ||
} | ||
@@ -42,0 +37,0 @@ |
@@ -534,9 +534,4 @@ (function webpackUniversalModuleDefinition(root, factory) { | ||
result = 1; | ||
} else if (abs < 1) { | ||
} else { | ||
result = Math.floor(Math.log(abs) / Math.log(10)) + 1; | ||
} else { | ||
var str = '' + value; | ||
var ary = str.split('.'); | ||
result = ary[0].length; | ||
} | ||
@@ -543,0 +538,0 @@ |
@@ -1,1 +0,1 @@ | ||
!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define([],t):"object"==typeof exports?exports.RechartsScale=t():e.RechartsScale=t()}(this,function(){return function(e){function t(n){if(r[n])return r[n].exports;var u=r[n]={exports:{},id:n,loaded:!1};return e[n].call(u.exports,u,u.exports,t),u.loaded=!0,u.exports}var r={};return t.m=e,t.c=r,t.p="",t(0)}([function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var n=r(2);Object.defineProperty(t,"getTickValues",{enumerable:!0,get:function(){return n.getTickValues}}),Object.defineProperty(t,"getNiceTickValues",{enumerable:!0,get:function(){return n.getNiceTickValues}}),Object.defineProperty(t,"getTickValuesFixedDomain",{enumerable:!0,get:function(){return n.getTickValuesFixedDomain}})},function(e,t){"use strict";function r(e){if(Array.isArray(e)){for(var t=0,r=Array(e.length);t<e.length;t++)r[t]=e[t];return r}return Array.from(e)}Object.defineProperty(t,"__esModule",{value:!0});var n=function(e){return e},u=t.PLACE_HOLDER={"@@functional/placeholder":!0},a=function(e){return e===u},i=function(e){return function t(){return 0===arguments.length||1===arguments.length&&a(arguments.length<=0?void 0:arguments[0])?t:e.apply(void 0,arguments)}},o=function e(t,n){return 1===t?n:i(function(){for(var o=arguments.length,l=Array(o),f=0;f<o;f++)l[f]=arguments[f];var c=l.filter(function(e){return e!==u}).length;return c>=t?n.apply(void 0,l):e(t-c,i(function(){for(var e=arguments.length,t=Array(e),u=0;u<e;u++)t[u]=arguments[u];var i=l.map(function(e){return a(e)?t.shift():e});return n.apply(void 0,r(i).concat(t))}))})},l=t.curry=function(e){return o(e.length,e)};t.range=function(e,t){for(var r=[],n=e;n<t;++n)r[n-e]=n;return r},t.map=l(function(e,t){return Array.isArray(t)?t.map(e):Object.keys(t).map(function(e){return t[e]}).map(e)}),t.compose=function(){for(var e=arguments.length,t=Array(e),r=0;r<e;r++)t[r]=arguments[r];if(!t.length)return n;var u=t.reverse(),a=u[0],i=u.slice(1);return function(){return i.reduce(function(e,t){return t(e)},a.apply(void 0,arguments))}},t.reverse=function(e){return Array.isArray(e)?e.reverse():e.split("").reverse.join("")},t.memoize=function(e){var t=null,r=null;return function(){for(var n=arguments.length,u=Array(n),a=0;a<n;a++)u[a]=arguments[a];return t&&u.every(function(e,r){return e===t[r]})?r:(t=u,r=e.apply(void 0,u))}}},function(e,t,r){"use strict";function n(e){return e&&e.__esModule?e:{default:e}}function u(e){if(Array.isArray(e)){for(var t=0,r=Array(e.length);t<e.length;t++)r[t]=e[t];return r}return Array.from(e)}function a(e){var t=p(e,2),r=t[0],n=t[1],u=r,a=n;return r>n&&(u=n,a=r),[u,a]}function i(e,t,r){if(e<=0)return 0;var n=h.default.getDigitCount(e),u=e/Math.pow(10,n),a=1!==n?h.default.multiply(Math.ceil(u/.05)+r,.05):h.default.multiply(Math.ceil(u/.1)+r,.1),i=h.default.multiply(a,Math.pow(10,n));return t?i:Math.ceil(i)}function o(e,t,r){var n=h.default.isFloat(e),u=1,a=e;if(n&&r){var i=Math.abs(e);i<1?(u=Math.pow(10,h.default.getDigitCount(e)-1),a=h.default.multiply(Math.floor(e/u),u)):i>1&&(a=Math.floor(e))}else 0===e?a=Math.floor((t-1)/2):r||(a=Math.floor(e));var o=Math.floor((t-1)/2),l=(0,d.compose)((0,d.map)(function(e){return h.default.sum(a,h.default.multiply(e-o,u))}),d.range);return l(0,t)}function l(e,t,r,n){var u=arguments.length>4&&void 0!==arguments[4]?arguments[4]:0,a=i((t-e)/(r-1),n,u),o=void 0;e<=0&&t>=0?o=0:(o=h.default.divide(h.default.sum(e,t),2),o=h.default.minus(o,h.default.modulo(o,a)));var f=Math.ceil((o-e)/a),c=Math.ceil((t-o)/a),s=f+c+1;return s>r?l(e,t,r,n,u+1):(s<r&&(c=t>0?c+(r-s):c,f=t>0?f:f+(r-s)),{step:a,tickMin:h.default.minus(o,h.default.multiply(f,a)),tickMax:h.default.sum(o,h.default.multiply(c,a))})}function f(e){var t=p(e,2),r=t[0],n=t[1],u=arguments.length>1&&void 0!==arguments[1]?arguments[1]:6,i=!(arguments.length>2&&void 0!==arguments[2])||arguments[2],f=Math.max(u,2),c=a([r,n]),s=p(c,2),v=s[0],m=s[1];if(v===m)return o(v,u,i);var g=l(v,m,f,i),y=g.step,M=g.tickMin,b=g.tickMax,x=h.default.rangeStep(M,b+.1*y,y);return r>n?(0,d.reverse)(x):x}function c(e){var t=p(e,2),r=t[0],n=t[1],u=arguments.length>1&&void 0!==arguments[1]?arguments[1]:6,l=!(arguments.length>2&&void 0!==arguments[2])||arguments[2],f=Math.max(u,2),c=a([r,n]),s=p(c,2),v=s[0],h=s[1];if(v===h)return o(v,u,l);var m=i((h-v)/(f-1),l,0),g=(0,d.compose)((0,d.map)(function(e){return v+e*m}),d.range),y=g(0,f).filter(function(e){return e>=v&&e<=h});return r>n?(0,d.reverse)(y):y}function s(e,t){var r=p(e,2),n=r[0],o=r[1],l=!(arguments.length>2&&void 0!==arguments[2])||arguments[2],f=a([n,o]),c=p(f,2),s=c[0],v=c[1];if(s===v)return[s];var m=Math.max(t,2),g=i((v-s)/(m-1),l,0),y=[].concat(u(h.default.rangeStep(s,v-.99*g,g)),[v]);return n>o?(0,d.reverse)(y):y}Object.defineProperty(t,"__esModule",{value:!0}),t.getTickValuesFixedDomain=t.getTickValues=t.getNiceTickValues=void 0;var p=function(){function e(e,t){var r=[],n=!0,u=!1,a=void 0;try{for(var i,o=e[Symbol.iterator]();!(n=(i=o.next()).done)&&(r.push(i.value),!t||r.length!==t);n=!0);}catch(e){u=!0,a=e}finally{try{!n&&o.return&&o.return()}finally{if(u)throw a}}return r}return function(t,r){if(Array.isArray(t))return t;if(Symbol.iterator in Object(t))return e(t,r);throw new TypeError("Invalid attempt to destructure non-iterable instance")}}(),d=r(1),v=r(3),h=n(v);t.getNiceTickValues=(0,d.memoize)(f),t.getTickValues=(0,d.memoize)(c),t.getTickValuesFixedDomain=(0,d.memoize)(s)},function(e,t,r){"use strict";function n(e){return/^([+-]?)\d*\.\d+$/.test(e)}function u(e){var t=Math.abs(e),r=void 0;if(0===e)r=1;else if(t<1)r=Math.floor(Math.log(t)/Math.log(10))+1;else{var n=""+e,u=n.split(".");r=u[0].length}return r}function a(e){var t=e?""+e:"",r=t.split(".");return r.length>1?r[1].length:0}function i(e,t){var r=parseInt((""+e).replace(".",""),10),n=parseInt((""+t).replace(".",""),10),u=a(e)+a(t);return r*n/Math.pow(10,u)}function o(e,t){var r=Math.max(a(e),a(t));return r=Math.pow(10,r),(i(e,r)+i(t,r))/r}function l(e,t){return o(e,-t)}function f(e,t){var r=a(e),n=a(t),u=parseInt((""+e).replace(".",""),10),i=parseInt((""+t).replace(".",""),10);return u/i*Math.pow(10,n-r)}function c(e,t){var r=Math.abs(t);if(t<=0)return e;var n=Math.floor(e/r);return l(e,i(r,n))}function s(e,t,r){for(var n=e,u=[];n<t;)u.push(n),n=o(n,r);return u}Object.defineProperty(t,"__esModule",{value:!0});var p=r(1),d=(0,p.curry)(function(e,t,r){var n=+e,u=+t;return n+r*(u-n)}),v=(0,p.curry)(function(e,t,r){var n=t-+e;return n=n||1/0,(r-e)/n}),h=(0,p.curry)(function(e,t,r){var n=t-+e;return n=n||1/0,Math.max(0,Math.min(1,(r-e)/n))});t.default={rangeStep:s,isFloat:n,getDigitCount:u,getDecimalDigitCount:a,sum:o,minus:l,multiply:i,divide:f,modulo:c,interpolateNumber:d,uninterpolateNumber:v,uninterpolateTruncation:h}}])}); | ||
!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define([],t):"object"==typeof exports?exports.RechartsScale=t():e.RechartsScale=t()}(this,function(){return function(e){function t(n){if(r[n])return r[n].exports;var u=r[n]={exports:{},id:n,loaded:!1};return e[n].call(u.exports,u,u.exports,t),u.loaded=!0,u.exports}var r={};return t.m=e,t.c=r,t.p="",t(0)}([function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var n=r(2);Object.defineProperty(t,"getTickValues",{enumerable:!0,get:function(){return n.getTickValues}}),Object.defineProperty(t,"getNiceTickValues",{enumerable:!0,get:function(){return n.getNiceTickValues}}),Object.defineProperty(t,"getTickValuesFixedDomain",{enumerable:!0,get:function(){return n.getTickValuesFixedDomain}})},function(e,t){"use strict";function r(e){if(Array.isArray(e)){for(var t=0,r=Array(e.length);t<e.length;t++)r[t]=e[t];return r}return Array.from(e)}Object.defineProperty(t,"__esModule",{value:!0});var n=function(e){return e},u=t.PLACE_HOLDER={"@@functional/placeholder":!0},a=function(e){return e===u},i=function(e){return function t(){return 0===arguments.length||1===arguments.length&&a(arguments.length<=0?void 0:arguments[0])?t:e.apply(void 0,arguments)}},o=function e(t,n){return 1===t?n:i(function(){for(var o=arguments.length,l=Array(o),c=0;c<o;c++)l[c]=arguments[c];var f=l.filter(function(e){return e!==u}).length;return f>=t?n.apply(void 0,l):e(t-f,i(function(){for(var e=arguments.length,t=Array(e),u=0;u<e;u++)t[u]=arguments[u];var i=l.map(function(e){return a(e)?t.shift():e});return n.apply(void 0,r(i).concat(t))}))})},l=t.curry=function(e){return o(e.length,e)};t.range=function(e,t){for(var r=[],n=e;n<t;++n)r[n-e]=n;return r},t.map=l(function(e,t){return Array.isArray(t)?t.map(e):Object.keys(t).map(function(e){return t[e]}).map(e)}),t.compose=function(){for(var e=arguments.length,t=Array(e),r=0;r<e;r++)t[r]=arguments[r];if(!t.length)return n;var u=t.reverse(),a=u[0],i=u.slice(1);return function(){return i.reduce(function(e,t){return t(e)},a.apply(void 0,arguments))}},t.reverse=function(e){return Array.isArray(e)?e.reverse():e.split("").reverse.join("")},t.memoize=function(e){var t=null,r=null;return function(){for(var n=arguments.length,u=Array(n),a=0;a<n;a++)u[a]=arguments[a];return t&&u.every(function(e,r){return e===t[r]})?r:(t=u,r=e.apply(void 0,u))}}},function(e,t,r){"use strict";function n(e){return e&&e.__esModule?e:{default:e}}function u(e){if(Array.isArray(e)){for(var t=0,r=Array(e.length);t<e.length;t++)r[t]=e[t];return r}return Array.from(e)}function a(e){var t=p(e,2),r=t[0],n=t[1],u=r,a=n;return r>n&&(u=n,a=r),[u,a]}function i(e,t,r){if(e<=0)return 0;var n=h.default.getDigitCount(e),u=e/Math.pow(10,n),a=1!==n?h.default.multiply(Math.ceil(u/.05)+r,.05):h.default.multiply(Math.ceil(u/.1)+r,.1),i=h.default.multiply(a,Math.pow(10,n));return t?i:Math.ceil(i)}function o(e,t,r){var n=h.default.isFloat(e),u=1,a=e;if(n&&r){var i=Math.abs(e);i<1?(u=Math.pow(10,h.default.getDigitCount(e)-1),a=h.default.multiply(Math.floor(e/u),u)):i>1&&(a=Math.floor(e))}else 0===e?a=Math.floor((t-1)/2):r||(a=Math.floor(e));var o=Math.floor((t-1)/2),l=(0,d.compose)((0,d.map)(function(e){return h.default.sum(a,h.default.multiply(e-o,u))}),d.range);return l(0,t)}function l(e,t,r,n){var u=arguments.length>4&&void 0!==arguments[4]?arguments[4]:0,a=i((t-e)/(r-1),n,u),o=void 0;e<=0&&t>=0?o=0:(o=h.default.divide(h.default.sum(e,t),2),o=h.default.minus(o,h.default.modulo(o,a)));var c=Math.ceil((o-e)/a),f=Math.ceil((t-o)/a),s=c+f+1;return s>r?l(e,t,r,n,u+1):(s<r&&(f=t>0?f+(r-s):f,c=t>0?c:c+(r-s)),{step:a,tickMin:h.default.minus(o,h.default.multiply(c,a)),tickMax:h.default.sum(o,h.default.multiply(f,a))})}function c(e){var t=p(e,2),r=t[0],n=t[1],u=arguments.length>1&&void 0!==arguments[1]?arguments[1]:6,i=!(arguments.length>2&&void 0!==arguments[2])||arguments[2],c=Math.max(u,2),f=a([r,n]),s=p(f,2),v=s[0],m=s[1];if(v===m)return o(v,u,i);var y=l(v,m,c,i),g=y.step,M=y.tickMin,b=y.tickMax,x=h.default.rangeStep(M,b+.1*g,g);return r>n?(0,d.reverse)(x):x}function f(e){var t=p(e,2),r=t[0],n=t[1],u=arguments.length>1&&void 0!==arguments[1]?arguments[1]:6,l=!(arguments.length>2&&void 0!==arguments[2])||arguments[2],c=Math.max(u,2),f=a([r,n]),s=p(f,2),v=s[0],h=s[1];if(v===h)return o(v,u,l);var m=i((h-v)/(c-1),l,0),y=(0,d.compose)((0,d.map)(function(e){return v+e*m}),d.range),g=y(0,c).filter(function(e){return e>=v&&e<=h});return r>n?(0,d.reverse)(g):g}function s(e,t){var r=p(e,2),n=r[0],o=r[1],l=!(arguments.length>2&&void 0!==arguments[2])||arguments[2],c=a([n,o]),f=p(c,2),s=f[0],v=f[1];if(s===v)return[s];var m=Math.max(t,2),y=i((v-s)/(m-1),l,0),g=[].concat(u(h.default.rangeStep(s,v-.99*y,y)),[v]);return n>o?(0,d.reverse)(g):g}Object.defineProperty(t,"__esModule",{value:!0}),t.getTickValuesFixedDomain=t.getTickValues=t.getNiceTickValues=void 0;var p=function(){function e(e,t){var r=[],n=!0,u=!1,a=void 0;try{for(var i,o=e[Symbol.iterator]();!(n=(i=o.next()).done)&&(r.push(i.value),!t||r.length!==t);n=!0);}catch(e){u=!0,a=e}finally{try{!n&&o.return&&o.return()}finally{if(u)throw a}}return r}return function(t,r){if(Array.isArray(t))return t;if(Symbol.iterator in Object(t))return e(t,r);throw new TypeError("Invalid attempt to destructure non-iterable instance")}}(),d=r(1),v=r(3),h=n(v);t.getNiceTickValues=(0,d.memoize)(c),t.getTickValues=(0,d.memoize)(f),t.getTickValuesFixedDomain=(0,d.memoize)(s)},function(e,t,r){"use strict";function n(e){return/^([+-]?)\d*\.\d+$/.test(e)}function u(e){var t=Math.abs(e),r=void 0;return r=0===e?1:Math.floor(Math.log(t)/Math.log(10))+1}function a(e){var t=e?""+e:"",r=t.split(".");return r.length>1?r[1].length:0}function i(e,t){var r=parseInt((""+e).replace(".",""),10),n=parseInt((""+t).replace(".",""),10),u=a(e)+a(t);return r*n/Math.pow(10,u)}function o(e,t){var r=Math.max(a(e),a(t));return r=Math.pow(10,r),(i(e,r)+i(t,r))/r}function l(e,t){return o(e,-t)}function c(e,t){var r=a(e),n=a(t),u=parseInt((""+e).replace(".",""),10),i=parseInt((""+t).replace(".",""),10);return u/i*Math.pow(10,n-r)}function f(e,t){var r=Math.abs(t);if(t<=0)return e;var n=Math.floor(e/r);return l(e,i(r,n))}function s(e,t,r){for(var n=e,u=[];n<t;)u.push(n),n=o(n,r);return u}Object.defineProperty(t,"__esModule",{value:!0});var p=r(1),d=(0,p.curry)(function(e,t,r){var n=+e,u=+t;return n+r*(u-n)}),v=(0,p.curry)(function(e,t,r){var n=t-+e;return n=n||1/0,(r-e)/n}),h=(0,p.curry)(function(e,t,r){var n=t-+e;return n=n||1/0,Math.max(0,Math.min(1,(r-e)/n))});t.default={rangeStep:s,isFloat:n,getDigitCount:u,getDecimalDigitCount:a,sum:o,minus:l,multiply:i,divide:c,modulo:f,interpolateNumber:d,uninterpolateNumber:v,uninterpolateTruncation:h}}])}); |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
90629
1990