Comparing version 0.1.2 to 0.2.0
@@ -15,2 +15,6 @@ /* | ||
function lshift(n, bits) { | ||
return Math.floor(n) * Math.pow(2, bits); | ||
} | ||
sparkline = function(numbers, options) { | ||
@@ -20,10 +24,17 @@ options = options || {}; | ||
min = typeof options.min === 'number' ? options.min : Math.min.apply(null, numbers), | ||
html = typeof options.html === 'boolean' ? options.html : false, | ||
results = [], | ||
f, i; | ||
f = ~~(((max - min) << 8) / (ticks.length - 1)); | ||
f = Math.floor(lshift(max - min, 8) / (ticks.length - 1)); | ||
if (f < 1) { f = 1; } | ||
for (i = 0; i < numbers.length; i++) { | ||
results.push(ticks[~~(((numbers[i] - min) << 8) / f)]); | ||
var value = ticks[Math.floor(lshift(numbers[i] - min, 8) / f)]; | ||
if (html) { | ||
value = '<span title="' + numbers[i] + '">' + value + '</span>'; | ||
} | ||
results.push(value); | ||
} | ||
@@ -30,0 +41,0 @@ |
{ | ||
"name": "sparkline", | ||
"description": "A JavaScript implementation of 'spark'.", | ||
"version": "0.1.2", | ||
"version": "0.2.0", | ||
"homepage": "https://github.com/shiwano/sparkline", | ||
@@ -34,12 +34,12 @@ "author": { | ||
"devDependencies": { | ||
"grunt-contrib-jshint": "~0.6.4", | ||
"grunt-contrib-nodeunit": "~0.2.1", | ||
"grunt-contrib-watch": "~0.5.3", | ||
"grunt": "~0.4.1" | ||
"grunt-contrib-jshint": "~1.1.0", | ||
"grunt-contrib-nodeunit": "~1.0.0", | ||
"grunt-contrib-watch": "~1.0.0", | ||
"grunt": "~1.0.1" | ||
}, | ||
"keywords": ["spark", "graph"], | ||
"dependencies": { | ||
"nopt": "~2.1.2", | ||
"nopt": "~4.0.1", | ||
"here": "0.0.2" | ||
} | ||
} |
@@ -42,2 +42,3 @@ # sparkline [![Build Status](https://secure.travis-ci.org/shiwano/sparkline.png?branch=master)](http://travis-ci.org/shiwano/sparkline) | ||
## Release History | ||
* 2017-06-23 v0.2.0 Add html option, and fix overflow bug. | ||
* 2015-07-17 v0.1.2 Add min/max options | ||
@@ -44,0 +45,0 @@ * 2013-06-01 v0.1.1 Support AMD and bower |
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
7414
101
50
+ Addednopt@4.0.3(transitive)
+ Addedos-homedir@1.0.2(transitive)
+ Addedos-tmpdir@1.0.2(transitive)
+ Addedosenv@0.1.5(transitive)
- Removednopt@2.1.2(transitive)
Updatednopt@~4.0.1