@oncojs/react-lolliplot
Advanced tools
Comparing version 0.11.6 to 0.11.7
import invariant from 'invariant'; | ||
import ReactFauxDOM from 'react-faux-dom'; | ||
import range from 'lodash.range'; | ||
import uniq from 'lodash.uniq'; | ||
import attrs from './utils/attrs'; | ||
@@ -46,2 +47,21 @@ import { dim } from './utils/spatial'; | ||
min = Math.floor(min); | ||
max = Math.round(max); | ||
var length = (max - min) / numXTicks; | ||
var uniqueXTicks = uniq(range(numXTicks - 1).map(function (x) { | ||
return x + 1; | ||
}).map(function (i) { | ||
return Math.round(length * i + min); | ||
})); | ||
var numUniqueXTicks = uniqueXTicks.length; | ||
var xTickInt = numUniqueXTicks.length === 1 ? 1 : uniqueXTicks[1] - uniqueXTicks[0]; | ||
// min & max are invisible ticks on the far left and right | ||
min = uniqueXTicks[0] - xTickInt; | ||
max = uniqueXTicks[numUniqueXTicks - 1]; | ||
d3.selection.prototype.attrs = attrs; | ||
@@ -269,9 +289,8 @@ d3.scaleOrdinal = d3.scaleOrdinal || d3.scale.ordinal; | ||
var length = (max - min) / numXTicks; | ||
var olength = domainWidth / numXTicks; | ||
var olength = domainWidth / numUniqueXTicks; | ||
d3Root.select('.xTicks').append('g').selectAll('text').data(range(numXTicks - 1).map(function (x) { | ||
d3Root.select('.xTicks').append('g').selectAll('text').data(range(numUniqueXTicks - 1).map(function (x) { | ||
return x + 1; | ||
})).enter().append('text').text(function (i) { | ||
return Math.round(length * i + min); | ||
return uniqueXTicks[i - 1]; | ||
}).attrs({ | ||
@@ -290,4 +309,4 @@ class: function _class(i) { | ||
for (var i = 1; i < numXTicks; i++) { | ||
var _length = domainWidth / numXTicks; | ||
for (var i = 1; i < numUniqueXTicks; i++) { | ||
var _length = domainWidth / numUniqueXTicks; | ||
@@ -294,0 +313,0 @@ d3Root.select('.xTicks').append('line').attrs({ |
@@ -17,2 +17,6 @@ 'use strict'; | ||
var _lodash3 = require('lodash.uniq'); | ||
var _lodash4 = _interopRequireDefault(_lodash3); | ||
var _attrs = require('./utils/attrs'); | ||
@@ -71,2 +75,21 @@ | ||
min = Math.floor(min); | ||
max = Math.round(max); | ||
var length = (max - min) / numXTicks; | ||
var uniqueXTicks = (0, _lodash4.default)((0, _lodash2.default)(numXTicks - 1).map(function (x) { | ||
return x + 1; | ||
}).map(function (i) { | ||
return Math.round(length * i + min); | ||
})); | ||
var numUniqueXTicks = uniqueXTicks.length; | ||
var xTickInt = numUniqueXTicks.length === 1 ? 1 : uniqueXTicks[1] - uniqueXTicks[0]; | ||
// min & max are invisible ticks on the far left and right | ||
min = uniqueXTicks[0] - xTickInt; | ||
max = uniqueXTicks[numUniqueXTicks - 1]; | ||
d3.selection.prototype.attrs = _attrs2.default; | ||
@@ -294,9 +317,8 @@ d3.scaleOrdinal = d3.scaleOrdinal || d3.scale.ordinal; | ||
var length = (max - min) / numXTicks; | ||
var olength = domainWidth / numXTicks; | ||
var olength = domainWidth / numUniqueXTicks; | ||
d3Root.select('.xTicks').append('g').selectAll('text').data((0, _lodash2.default)(numXTicks - 1).map(function (x) { | ||
d3Root.select('.xTicks').append('g').selectAll('text').data((0, _lodash2.default)(numUniqueXTicks - 1).map(function (x) { | ||
return x + 1; | ||
})).enter().append('text').text(function (i) { | ||
return Math.round(length * i + min); | ||
return uniqueXTicks[i - 1]; | ||
}).attrs({ | ||
@@ -315,4 +337,4 @@ class: function _class(i) { | ||
for (var i = 1; i < numXTicks; i++) { | ||
var _length = domainWidth / numXTicks; | ||
for (var i = 1; i < numUniqueXTicks; i++) { | ||
var _length = domainWidth / numUniqueXTicks; | ||
@@ -319,0 +341,0 @@ d3Root.select('.xTicks').append('line').attrs({ |
@@ -6,2 +6,3 @@ // @flow | ||
import range from 'lodash.range' | ||
import uniq from 'lodash.uniq' | ||
import attrs from './utils/attrs' | ||
@@ -37,2 +38,23 @@ import { dim } from './utils/spatial' | ||
min = Math.floor(min) | ||
max = Math.round(max) | ||
let length = (max - min) / numXTicks | ||
const uniqueXTicks = uniq( | ||
range(numXTicks - 1) | ||
.map(x => x + 1) | ||
.map(i => Math.round(length * i + min)) | ||
) | ||
const numUniqueXTicks = uniqueXTicks.length | ||
const xTickInt = numUniqueXTicks.length === 1 | ||
? 1 | ||
: uniqueXTicks[1] - uniqueXTicks[0] | ||
// min & max are invisible ticks on the far left and right | ||
min = uniqueXTicks[0] - xTickInt | ||
max = uniqueXTicks[numUniqueXTicks - 1] | ||
d3.selection.prototype.attrs = attrs | ||
@@ -273,4 +295,3 @@ d3.scaleOrdinal = d3.scaleOrdinal || d3.scale.ordinal | ||
let length = (max - min) / numXTicks | ||
let olength = domainWidth / numXTicks | ||
let olength = domainWidth / numUniqueXTicks | ||
@@ -281,6 +302,6 @@ d3Root | ||
.selectAll(`text`) | ||
.data(range(numXTicks - 1).map(x => x + 1)) | ||
.data(range(numUniqueXTicks - 1).map(x => x + 1)) | ||
.enter() | ||
.append(`text`) | ||
.text(i => Math.round(length * i + min)) | ||
.text(i => uniqueXTicks[i - 1]) | ||
.attrs({ | ||
@@ -295,4 +316,4 @@ class: i => `xTick-text-${i}`, | ||
for (let i = 1; i < numXTicks; i++) { | ||
let length = domainWidth / numXTicks | ||
for (let i = 1; i < numUniqueXTicks; i++) { | ||
let length = domainWidth / numUniqueXTicks | ||
@@ -299,0 +320,0 @@ d3Root |
{ | ||
"homepage": "https://github.com/oncojs/lolliplot#readme", | ||
"license": "Apache-2.0", | ||
"bugs": { | ||
"url": "https://github.com/oncojs/lolliplot/issues" | ||
}, | ||
"keywords": [ | ||
"d3", | ||
"react", | ||
"reactjs", | ||
"boilerplate", | ||
"hot", | ||
"reload", | ||
"hmr", | ||
"live", | ||
"edit", | ||
"webpack" | ||
], | ||
"repository": { | ||
"type": "git", | ||
"url": "git+https://github.com/oncojs/lolliplot.git" | ||
}, | ||
"author": { | ||
"name": "OncoJS", | ||
"url": "https://github.com/oncojs/" | ||
}, | ||
"private": false, | ||
"name": "@oncojs/react-lolliplot", | ||
"version": "0.11.6", | ||
"version": "0.11.7", | ||
"description": "A protein viewer built with d3 (React Component)", | ||
"browser": "dist/umd/index.min.js", | ||
"main": "dist/lib/index.js", | ||
"dependencies": { | ||
"d3-selection": "^1.0.3", | ||
"invariant": "^2.2.2", | ||
"lodash.range": "^3.2.0", | ||
"react-faux-dom": "^3.0.1" | ||
}, | ||
"peerDependencies": { | ||
"react": "15" | ||
}, | ||
"jsnext:main": "dist/es6/index.js" | ||
"browser": true | ||
} |
let uuid = a => a | ||
? (a ^ Math.random() * 16 >> a / 4).toString(16) | ||
: ([1e7] + -1e3 + -4e3 + -8e3 + -1e11).replace(/[018]/g, uuid) | ||
export default uuid |
Sorry, the diff of this file is too big to display
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
Deprecated
MaintenanceThe maintainer of the package marked it as deprecated. This could indicate that a single version should not be used, or that the package is no longer maintained and any new vulnerabilities will not be fixed.
Found 1 instance in 1 package
Uses eval
Supply chain riskPackage uses dynamic code execution (e.g., eval()), which is a dangerous practice. This can prevent the code from running in certain environments and increases the risk that the code may contain exploits or malicious behavior.
Found 2 instances in 1 package
No contributors or author data
MaintenancePackage does not specify a list of contributors or an author in package.json.
Found 1 instance in 1 package
No bug tracker
MaintenancePackage does not have a linked bug tracker in package.json.
Found 1 instance in 1 package
No License Found
License(Experimental) License information could not be found.
Found 1 instance in 1 package
No repository
Supply chain riskPackage does not have a linked source code repository. Without this field, a package will have no reference to the location of the source code use to generate the package.
Found 1 instance in 1 package
No website
QualityPackage does not have a website.
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
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
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
1358022
0
9709
1
2
1
2
1
3
- Removedd3-selection@^1.0.3
- Removedinvariant@^2.2.2
- Removedlodash.range@^3.2.0
- Removedreact-faux-dom@^3.0.1
- Removedasap@2.0.6(transitive)
- Removedcore-js@1.2.7(transitive)
- Removedcreate-react-class@15.7.0(transitive)
- Removedd3-selection@1.4.2(transitive)
- Removedencoding@0.1.13(transitive)
- Removedfbjs@0.8.18(transitive)
- Removediconv-lite@0.6.3(transitive)
- Removedinvariant@2.2.4(transitive)
- Removedis-stream@1.1.0(transitive)
- Removedisomorphic-fetch@2.2.1(transitive)
- Removedjs-tokens@4.0.0(transitive)
- Removedlodash.range@3.2.0(transitive)
- Removedloose-envify@1.4.0(transitive)
- Removednode-fetch@1.7.3(transitive)
- Removedobject-assign@4.1.1(transitive)
- Removedpromise@7.3.1(transitive)
- Removedprop-types@15.8.1(transitive)
- Removedquery-selector@1.0.9(transitive)
- Removedreact@15.7.0(transitive)
- Removedreact-faux-dom@3.1.0(transitive)
- Removedreact-is@16.13.1(transitive)
- Removedsafer-buffer@2.1.2(transitive)
- Removedsetimmediate@1.0.5(transitive)
- Removedstyle-attr@1.3.0(transitive)
- Removedua-parser-js@0.7.40(transitive)
- Removedwhatwg-fetch@3.6.20(transitive)