@oncojs/react-lolliplot
Advanced tools
Comparing version 0.10.6 to 0.10.7
@@ -78,7 +78,5 @@ // @flow | ||
chart | ||
.append(`g`) | ||
.selectAll(`rect`) | ||
.data(data) | ||
.enter() | ||
let rects = chart.append(`g`).selectAll(`rect`).data(data).enter().append(`g`) | ||
rects | ||
.append(`rect`) | ||
@@ -89,3 +87,6 @@ .attrs({ | ||
x: d => Math.max(yAxisOffset, scaleLinear(d.start)) + halfPixel, | ||
y: Math.round(height / 2) - 7, | ||
y: (d, i) => { | ||
let overlap = data[i - 1] && data[i - 1].end > d.start | ||
return Math.round(height / 2) - (overlap ? 4 - i * 2 : 7) | ||
}, | ||
width: d => { | ||
@@ -133,2 +134,19 @@ let barWidth = (d.end - Math.max(d.start, min)) * widthZoomRatio * scale | ||
rects.append(`text`).text(d => d.id.toUpperCase()).attrs({ | ||
class: d => `protein-name-${d.id}-${d.start}-${d.end}`, | ||
"clip-path": d => `url(#${uniqueSelector}-clip-range-${d.id}-${d.start}-${d.end})`, | ||
x: d => { | ||
let barWidth = (d.end - Math.max(d.start, min)) * widthZoomRatio * scale | ||
let x = scaleLinear(d.start) | ||
return (barWidth + yAxisOffset < yAxisOffset ? x : Math.max(yAxisOffset, x)) + 6 | ||
}, | ||
y: (d, i) => { | ||
let overlap = data[i - 1] && data[i - 1].end > d.start | ||
return height - (overlap ? 22 - i * 2 : 25) | ||
}, | ||
fill: `white`, | ||
"font-size": `11px`, | ||
"pointer-events": `none`, | ||
}) | ||
chart | ||
@@ -151,29 +169,5 @@ .append(`g`) | ||
}, | ||
height: height - 50 - halfPixel, | ||
height: height - 40 - halfPixel, | ||
}) | ||
chart | ||
.append(`g`) | ||
.attrs({ | ||
"clip-path": `url(#${uniqueSelector}-chart-clip)`, | ||
}) | ||
.selectAll(`text`) | ||
.data(data) | ||
.enter() | ||
.append(`text`) | ||
.text(d => d.id.toUpperCase()) | ||
.attrs({ | ||
class: d => `protein-name-${d.id}-${d.start}-${d.end}`, | ||
"clip-path": d => `url(#${uniqueSelector}-clip-range-${d.id}-${d.start}-${d.end})`, | ||
x: d => { | ||
let barWidth = (d.end - Math.max(d.start, min)) * widthZoomRatio * scale | ||
let x = scaleLinear(d.start) | ||
return (barWidth + yAxisOffset < yAxisOffset ? x : Math.max(yAxisOffset, x)) + 6 | ||
}, | ||
y: height - 25, | ||
fill: `white`, | ||
"font-size": `11px`, | ||
"pointer-events": `none`, | ||
}) | ||
return root.toReact() | ||
@@ -180,0 +174,0 @@ } |
@@ -81,3 +81,5 @@ import React from "react"; | ||
chart.append("g").selectAll("rect").data(data).enter().append("rect").attrs({ | ||
var rects = chart.append("g").selectAll("rect").data(data).enter().append("g"); | ||
rects.append("rect").attrs({ | ||
"clip-path": "url(#" + uniqueSelector + "-chart-clip)", | ||
@@ -90,3 +92,6 @@ class: function _class(d) { | ||
}, | ||
y: Math.round(height / 2) - 7, | ||
y: function y(d, i) { | ||
var overlap = data[i - 1] && data[i - 1].end > d.start; | ||
return Math.round(height / 2) - (overlap ? 4 - i * 2 : 7); | ||
}, | ||
width: function width(d) { | ||
@@ -121,22 +126,3 @@ var barWidth = (d.end - Math.max(d.start, min)) * widthZoomRatio * scale; | ||
chart.append("g").attr("class", "protein-text-clip-path").selectAll("clipPath").data(data).enter().append("clipPath").attr("id", function (d) { | ||
return uniqueSelector + "-clip-range-" + d.id + "-" + d.start + "-" + d.end; | ||
}).append("rect").attrs({ | ||
class: function _class(d) { | ||
return "clip-range-" + d.id + "-" + d.start + "-" + d.end + "-rect"; | ||
}, | ||
x: function x(d) { | ||
return Math.max(yAxisOffset, scaleLinear(d.start)) + halfPixel; | ||
}, | ||
y: Math.round(height / 2) - 7, | ||
width: function width(d) { | ||
var barWidth = (d.end - Math.max(d.start, min)) * widthZoomRatio * scale; | ||
return Math.max(0, barWidth - 1); | ||
}, | ||
height: height - 50 - halfPixel | ||
}); | ||
chart.append("g").attrs({ | ||
"clip-path": "url(#" + uniqueSelector + "-chart-clip)" | ||
}).selectAll("text").data(data).enter().append("text").text(function (d) { | ||
rects.append("text").text(function (d) { | ||
return d.id.toUpperCase(); | ||
@@ -155,3 +141,6 @@ }).attrs({ | ||
}, | ||
y: height - 25, | ||
y: function y(d, i) { | ||
var overlap = data[i - 1] && data[i - 1].end > d.start; | ||
return height - (overlap ? 22 - i * 2 : 25); | ||
}, | ||
fill: "white", | ||
@@ -162,2 +151,19 @@ "font-size": "11px", | ||
chart.append("g").attr("class", "protein-text-clip-path").selectAll("clipPath").data(data).enter().append("clipPath").attr("id", function (d) { | ||
return uniqueSelector + "-clip-range-" + d.id + "-" + d.start + "-" + d.end; | ||
}).append("rect").attrs({ | ||
class: function _class(d) { | ||
return "clip-range-" + d.id + "-" + d.start + "-" + d.end + "-rect"; | ||
}, | ||
x: function x(d) { | ||
return Math.max(yAxisOffset, scaleLinear(d.start)) + halfPixel; | ||
}, | ||
y: Math.round(height / 2) - 7, | ||
width: function width(d) { | ||
var barWidth = (d.end - Math.max(d.start, min)) * widthZoomRatio * scale; | ||
return Math.max(0, barWidth - 1); | ||
}, | ||
height: height - 40 - halfPixel | ||
}); | ||
return root.toReact(); | ||
@@ -164,0 +170,0 @@ }; |
@@ -102,3 +102,5 @@ "use strict"; | ||
chart.append("g").selectAll("rect").data(data).enter().append("rect").attrs({ | ||
var rects = chart.append("g").selectAll("rect").data(data).enter().append("g"); | ||
rects.append("rect").attrs({ | ||
"clip-path": "url(#" + uniqueSelector + "-chart-clip)", | ||
@@ -111,3 +113,6 @@ class: function _class(d) { | ||
}, | ||
y: Math.round(height / 2) - 7, | ||
y: function y(d, i) { | ||
var overlap = data[i - 1] && data[i - 1].end > d.start; | ||
return Math.round(height / 2) - (overlap ? 4 - i * 2 : 7); | ||
}, | ||
width: function width(d) { | ||
@@ -142,22 +147,3 @@ var barWidth = (d.end - Math.max(d.start, min)) * widthZoomRatio * scale; | ||
chart.append("g").attr("class", "protein-text-clip-path").selectAll("clipPath").data(data).enter().append("clipPath").attr("id", function (d) { | ||
return uniqueSelector + "-clip-range-" + d.id + "-" + d.start + "-" + d.end; | ||
}).append("rect").attrs({ | ||
class: function _class(d) { | ||
return "clip-range-" + d.id + "-" + d.start + "-" + d.end + "-rect"; | ||
}, | ||
x: function x(d) { | ||
return Math.max(yAxisOffset, scaleLinear(d.start)) + _spatial.halfPixel; | ||
}, | ||
y: Math.round(height / 2) - 7, | ||
width: function width(d) { | ||
var barWidth = (d.end - Math.max(d.start, min)) * widthZoomRatio * scale; | ||
return Math.max(0, barWidth - 1); | ||
}, | ||
height: height - 50 - _spatial.halfPixel | ||
}); | ||
chart.append("g").attrs({ | ||
"clip-path": "url(#" + uniqueSelector + "-chart-clip)" | ||
}).selectAll("text").data(data).enter().append("text").text(function (d) { | ||
rects.append("text").text(function (d) { | ||
return d.id.toUpperCase(); | ||
@@ -176,3 +162,6 @@ }).attrs({ | ||
}, | ||
y: height - 25, | ||
y: function y(d, i) { | ||
var overlap = data[i - 1] && data[i - 1].end > d.start; | ||
return height - (overlap ? 22 - i * 2 : 25); | ||
}, | ||
fill: "white", | ||
@@ -183,2 +172,19 @@ "font-size": "11px", | ||
chart.append("g").attr("class", "protein-text-clip-path").selectAll("clipPath").data(data).enter().append("clipPath").attr("id", function (d) { | ||
return uniqueSelector + "-clip-range-" + d.id + "-" + d.start + "-" + d.end; | ||
}).append("rect").attrs({ | ||
class: function _class(d) { | ||
return "clip-range-" + d.id + "-" + d.start + "-" + d.end + "-rect"; | ||
}, | ||
x: function x(d) { | ||
return Math.max(yAxisOffset, scaleLinear(d.start)) + _spatial.halfPixel; | ||
}, | ||
y: Math.round(height / 2) - 7, | ||
width: function width(d) { | ||
var barWidth = (d.end - Math.max(d.start, min)) * widthZoomRatio * scale; | ||
return Math.max(0, barWidth - 1); | ||
}, | ||
height: height - 40 - _spatial.halfPixel | ||
}); | ||
return root.toReact(); | ||
@@ -185,0 +191,0 @@ }; |
@@ -29,3 +29,3 @@ { | ||
"name": "@oncojs/react-lolliplot", | ||
"version": "0.10.6", | ||
"version": "0.10.7", | ||
"description": "A protein viewer built with d3 (React Component)", | ||
@@ -32,0 +32,0 @@ "browser": "dist/umd/index.min.js", |
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
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
1298738
8731