react-d3-core
Advanced tools
Comparing version 0.2.2 to 0.2.3
@@ -68,3 +68,3 @@ "use strict"; | ||
var bgRect = legend.append("rect").attr("x", -20).attr("y", -4).attr("width", 220).attr("height", 20).style("fill", "#EEE").style("fill-opacity", 0.3); | ||
var bgRect = legend.append("rect").attr("y", -4).attr("width", 220).attr("height", 20).style("fill", "#EEE").style("fill-opacity", 0.3); | ||
@@ -76,3 +76,3 @@ var rect = legend.append("rect").attr("width", 18).attr("height", 18).style("fill", function (d) { | ||
var text = legend.append("text").attr("y", 9).attr("dy", ".35em").text(function (d) { | ||
return d.name.substring(0, 20); | ||
if (d.name.length > 20) return d.name.substring(0, 20) + '...';else return d.name; | ||
}); | ||
@@ -86,2 +86,3 @@ | ||
text.attr("x", -24).style("text-anchor", "end"); | ||
bgRect.attr("x", -200); | ||
} else if (legendPosition === 'left') { | ||
@@ -93,2 +94,3 @@ legend.attr("transform", function (d, i) { | ||
text.attr("x", 24).style("text-anchor", "start"); | ||
bgRect.attr("x", -20); | ||
} | ||
@@ -95,0 +97,0 @@ } |
{ | ||
"name": "react-d3-core", | ||
"version": "0.2.2", | ||
"version": "0.2.3", | ||
"description": "react-d3 chart core component", | ||
@@ -5,0 +5,0 @@ "main": "./lib/index.js", |
@@ -77,3 +77,2 @@ "use strict"; | ||
var bgRect = legend.append("rect") | ||
.attr("x", -20) | ||
.attr("y", -4) | ||
@@ -93,3 +92,8 @@ .attr("width", 220) | ||
.attr("dy", ".35em") | ||
.text((d) => { return d.name.substring(0, 20); }); | ||
.text((d) => { | ||
if(d.name.length > 20) | ||
return `${d.name.substring(0, 20)}...`; | ||
else | ||
return d.name; | ||
}); | ||
@@ -101,2 +105,3 @@ if(legendPosition === 'right') { | ||
.style("text-anchor", "end") | ||
bgRect.attr("x", -200) | ||
}else if(legendPosition === 'left') { | ||
@@ -107,2 +112,3 @@ legend.attr("transform", (d, i) => { return `translate(${margins.left + legendOffset}, ${margins.top + i * 20})`; }); | ||
.style("text-anchor", "start") | ||
bgRect.attr("x", -20) | ||
} | ||
@@ -109,0 +115,0 @@ } |
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
4353466
32045