Comparing version 0.1.0 to 0.1.1
@@ -12,16 +12,11 @@ /* | ||
var undefined, | ||
sparkline, | ||
var sparkline, | ||
ticks = ['▁', '▂', '▃', '▄', '▅', '▆', '▇', '█']; | ||
sparkline = function(numbers) { | ||
var i, n, min, max, f, | ||
results = []; | ||
var max = Math.max.apply(null, numbers), | ||
min = Math.min.apply(null, numbers), | ||
results = [], | ||
f, i; | ||
for (i = 0; i < numbers.length; i++) { | ||
n = numbers[i]; | ||
if (min === undefined || n < min) { min = n; } | ||
if (max === undefined || n > max) { max = n; } | ||
} | ||
f = ~~(((max - min) << 8) / (ticks.length - 1)); | ||
@@ -31,4 +26,3 @@ if (f < 1) { f = 1; } | ||
for (i = 0; i < numbers.length; i++) { | ||
n = numbers[i]; | ||
results.push(ticks[~~(((n - min) << 8) / f)]); | ||
results.push(ticks[~~(((numbers[i] - min) << 8) / f)]); | ||
} | ||
@@ -43,3 +37,7 @@ | ||
window.sparkline = sparkline; | ||
if (typeof define === 'function' && define.amd) { | ||
define('sparkline', [], function () { return sparkline; }); | ||
} | ||
} | ||
})(this); |
{ | ||
"name": "sparkline", | ||
"description": "JavaScript implementation of 'spark'.", | ||
"version": "0.1.0", | ||
"version": "0.1.1", | ||
"homepage": "https://github.com/shiwano/sparkline", | ||
@@ -6,0 +6,0 @@ "author": { |
@@ -42,2 +42,3 @@ # sparkline | ||
## Release History | ||
* 2013-06-01 v0.1.1 Support AMD and bower | ||
* 2013-05-30 v0.1.0 First release. | ||
@@ -44,0 +45,0 @@ |
Sorry, the diff of this file is not supported yet
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
8632
10
151
48