lightning-client-utils
Advanced tools
Comparing version
20
index.js
var _ = require('lodash'); | ||
var request = require('superagent'); | ||
var d3 = require('d3'); | ||
var d3Color = require('d3-color'); | ||
var d3Scale = require('d3-color'); | ||
var colorbrewer = require('colorbrewer') | ||
@@ -68,4 +70,4 @@ var Color = require('color'); | ||
label = data.label | ||
var mn = d3.min(label, function(d) {return d; }); | ||
var mx = d3.max(label, function(d) {return d; }); | ||
var mn = Math.min.apply(null, label); | ||
var mx = Math.max.apply(null, label); | ||
var n = mx - mn + 1 | ||
@@ -75,3 +77,3 @@ var colors = this.getColors(n) | ||
// get an array of d3 colors | ||
retColor = label.map(function(d) {return d3.rgb(colors[d - mn])}); | ||
retColor = label.map(function(d) {return d3Color.rgb(colors[d - mn])}); | ||
@@ -82,3 +84,3 @@ } else if (data.hasOwnProperty('color')) { | ||
color = data.color | ||
retColor = color.map(function(d) {return d3.rgb(d[0], d[1], d[2])}) | ||
retColor = color.map(function(d) {return d3Color.rgb(d[0], d[1], d[2])}) | ||
@@ -100,10 +102,10 @@ } else if (data.hasOwnProperty('value')) { | ||
// get min and max of value data | ||
var vmin = d3.min(value) | ||
var vmax = d3.max(value) | ||
var vmin = Math.min.apply(null, value); | ||
var vmax = Math.max.apply(null, value); | ||
// set up scales | ||
var domain = this.linspace(vmin, vmax, ncolor) | ||
var scale = d3.scale.linear().domain(domain).range(color); | ||
var scale = d3Scale.linear().domain(domain).range(color); | ||
retColor = value.map(function(d) {return d3.rgb(scale(d))}) | ||
retColor = value.map(function(d) {return d3Color.rgb(scale(d))}) | ||
@@ -110,0 +112,0 @@ } else { |
{ | ||
"name": "lightning-client-utils", | ||
"version": "0.6.4", | ||
"version": "0.6.5", | ||
"description": "utilities for lightning visualizations to be used in the browser", | ||
@@ -18,7 +18,8 @@ "main": "index.js", | ||
"dependencies": { | ||
"color": "^0.7.3", | ||
"colorbrewer": "0.0.2", | ||
"d3-color": "^0.2.4", | ||
"d3-scale": "^0.1.1", | ||
"lodash": "^2.4.1", | ||
"superagent": "^0.21.0", | ||
"d3": "~3.4.9", | ||
"colorbrewer": "0.0.2", | ||
"color": "^0.7.3" | ||
"superagent": "^0.21.0" | ||
}, | ||
@@ -25,0 +26,0 @@ "devDependencies": {}, |
New author
Supply chain riskA new npm collaborator published a version of the package for the first time. New collaborators are usually benign additions to a project, but do indicate a change to the security surface area of a package.
Found 1 instance in 1 package
13863
0.63%305
0.33%0
-100%6
20%+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed