react-d3-core
Advanced tools
Comparing version 0.2.1 to 0.2.2
@@ -122,7 +122,7 @@ # Legend | ||
![legendPositionLeft](./imgs/legend-left.png) | ||
![legendPositionLeft](./img/legend-left.png) | ||
#### legendPosition = 'right' | ||
![legendPositionRight](./imgs/legend-right.png) | ||
![legendPositionRight](./img/legend-right.png) | ||
@@ -185,2 +185,2 @@ ### legendOffset | ||
![legend](./imgs/legend.png) | ||
![legend](./img/legend.png) |
@@ -68,2 +68,4 @@ "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 rect = legend.append("rect").attr("width", 18).attr("height", 18).style("fill", function (d) { | ||
@@ -74,3 +76,3 @@ return d.color; | ||
var text = legend.append("text").attr("y", 9).attr("dy", ".35em").text(function (d) { | ||
return d.name; | ||
return d.name.substring(0, 20); | ||
}); | ||
@@ -77,0 +79,0 @@ |
{ | ||
"name": "react-d3-core", | ||
"version": "0.2.1", | ||
"version": "0.2.2", | ||
"description": "react-d3 chart core component", | ||
@@ -5,0 +5,0 @@ "main": "./lib/index.js", |
@@ -74,4 +74,12 @@ "use strict"; | ||
.enter().append("g") | ||
.attr("class", `${legendClassName} legend`) | ||
.attr("class", `${legendClassName} legend`); | ||
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 rect = legend.append("rect") | ||
@@ -85,3 +93,3 @@ .attr("width", 18) | ||
.attr("dy", ".35em") | ||
.text((d) => { return d.name; }); | ||
.text((d) => { return d.name.substring(0, 20); }); | ||
@@ -88,0 +96,0 @@ if(legendPosition === 'right') { |
4353239
32037