d3plus-legend
Advanced tools
Comparing version 1.0.0 to 1.0.1
@@ -33,2 +33,3 @@ function _typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); } | ||
import { TextBox, textWidth, textWrap } from "d3plus-text"; | ||
var padding = 5; | ||
/** | ||
@@ -56,2 +57,3 @@ @class Legend | ||
_this = _super.call(this); | ||
_this._titleClass = new TextBox(); | ||
_this._align = "center"; | ||
@@ -89,4 +91,4 @@ _this._data = []; | ||
var d = _this._lineData[i]; | ||
var x = d.shapeWidth; | ||
if (d.shape === "Circle") x -= d.shapeR; | ||
var x = d.shapeWidth / 2; | ||
if (d.shape === "Circle") x -= d.shapeR / 2; | ||
var height = max([d.shapeHeight, d.height]); | ||
@@ -96,3 +98,3 @@ return { | ||
height: height, | ||
x: x, | ||
x: x + padding, | ||
y: -height / 2 | ||
@@ -103,2 +105,3 @@ }; | ||
fontColor: constant(colorDefaults.dark), | ||
fontFamily: _this._titleClass.fontFamily(), | ||
fontResize: false, | ||
@@ -137,3 +140,2 @@ fontSize: constant(10), | ||
}; | ||
_this._titleClass = new TextBox(); | ||
_this._titleConfig = { | ||
@@ -252,3 +254,3 @@ fontSize: 12 | ||
}); | ||
}))) + s * 0.75; | ||
}))) + padding * 2; | ||
res.height = Math.ceil(res.lines.length * (lh + 1)); | ||
@@ -255,0 +257,0 @@ res.og = { |
{ | ||
"name": "d3plus-legend", | ||
"version": "1.0.0", | ||
"version": "1.0.1", | ||
"description": "An easy to use javascript chart legend.", | ||
@@ -31,4 +31,4 @@ "main": "build/d3plus-legend.full.js", | ||
"d3plus-color": "^1.0.0", | ||
"d3plus-common": "^1.0.0", | ||
"d3plus-shape": "^1.0.0", | ||
"d3plus-common": "^1.0.2", | ||
"d3plus-shape": "^1.0.3", | ||
"d3plus-text": "^1.0.1" | ||
@@ -35,0 +35,0 @@ }, |
@@ -327,3 +327,3 @@ # d3plus-legend | ||
<a name="Legend"></a> | ||
#### **Legend** [<>](https://github.com/d3plus/d3plus-legend/blob/master/src/Legend.js#L14) | ||
#### **Legend** [<>](https://github.com/d3plus/d3plus-legend/blob/master/src/Legend.js#L16) | ||
@@ -365,3 +365,3 @@ | ||
<a name="Legend.render" href="#Legend.render">#</a> Legend.**render**([*callback*]) [<>](https://github.com/d3plus/d3plus-legend/blob/master/src/Legend.js#L117) | ||
<a name="Legend.render" href="#Legend.render">#</a> Legend.**render**([*callback*]) [<>](https://github.com/d3plus/d3plus-legend/blob/master/src/Legend.js#L121) | ||
@@ -374,3 +374,3 @@ Renders the current Legend to the page. If a *callback* is specified, it will be called once the legend is done drawing. | ||
<a name="Legend.active" href="#Legend.active">#</a> Legend.**active**([*value*]) [<>](https://github.com/d3plus/d3plus-legend/blob/master/src/Legend.js#L376) | ||
<a name="Legend.active" href="#Legend.active">#</a> Legend.**active**([*value*]) [<>](https://github.com/d3plus/d3plus-legend/blob/master/src/Legend.js#L380) | ||
@@ -383,3 +383,3 @@ If *value* is specified, sets the active method for all shapes to the specified function and returns the current class instance. If *value* is not specified, returns the current active method. | ||
<a name="Legend.align" href="#Legend.align">#</a> Legend.**align**([*value*]) [<>](https://github.com/d3plus/d3plus-legend/blob/master/src/Legend.js#L387) | ||
<a name="Legend.align" href="#Legend.align">#</a> Legend.**align**([*value*]) [<>](https://github.com/d3plus/d3plus-legend/blob/master/src/Legend.js#L391) | ||
@@ -392,3 +392,3 @@ If *value* is specified, sets the horizontal alignment to the specified value and returns the current class instance. If *value* is not specified, returns the current horizontal alignment. | ||
<a name="Legend.data" href="#Legend.data">#</a> Legend.**data**([*data*]) [<>](https://github.com/d3plus/d3plus-legend/blob/master/src/Legend.js#L397) | ||
<a name="Legend.data" href="#Legend.data">#</a> Legend.**data**([*data*]) [<>](https://github.com/d3plus/d3plus-legend/blob/master/src/Legend.js#L401) | ||
@@ -401,3 +401,3 @@ If *data* is specified, sets the data array to the specified array and returns the current class instance. If *data* is not specified, returns the current data array. A shape key will be drawn for each object in the array. | ||
<a name="Legend.direction" href="#Legend.direction">#</a> Legend.**direction**([*value*]) [<>](https://github.com/d3plus/d3plus-legend/blob/master/src/Legend.js#L407) | ||
<a name="Legend.direction" href="#Legend.direction">#</a> Legend.**direction**([*value*]) [<>](https://github.com/d3plus/d3plus-legend/blob/master/src/Legend.js#L411) | ||
@@ -410,3 +410,3 @@ Sets the flow of the items inside the legend. If no value is passed, the current flow will be returned. | ||
<a name="Legend.duration" href="#Legend.duration">#</a> Legend.**duration**([*value*]) [<>](https://github.com/d3plus/d3plus-legend/blob/master/src/Legend.js#L417) | ||
<a name="Legend.duration" href="#Legend.duration">#</a> Legend.**duration**([*value*]) [<>](https://github.com/d3plus/d3plus-legend/blob/master/src/Legend.js#L421) | ||
@@ -419,3 +419,3 @@ If *value* is specified, sets the transition duration of the legend and returns the current class instance. If *value* is not specified, returns the current duration. | ||
<a name="Legend.height" href="#Legend.height">#</a> Legend.**height**([*value*]) [<>](https://github.com/d3plus/d3plus-legend/blob/master/src/Legend.js#L427) | ||
<a name="Legend.height" href="#Legend.height">#</a> Legend.**height**([*value*]) [<>](https://github.com/d3plus/d3plus-legend/blob/master/src/Legend.js#L431) | ||
@@ -428,3 +428,3 @@ If *value* is specified, sets the overall height of the legend and returns the current class instance. If *value* is not specified, returns the current height value. | ||
<a name="Legend.hover" href="#Legend.hover">#</a> Legend.**hover**([*value*]) [<>](https://github.com/d3plus/d3plus-legend/blob/master/src/Legend.js#L437) | ||
<a name="Legend.hover" href="#Legend.hover">#</a> Legend.**hover**([*value*]) [<>](https://github.com/d3plus/d3plus-legend/blob/master/src/Legend.js#L441) | ||
@@ -437,3 +437,3 @@ If *value* is specified, sets the hover method for all shapes to the specified function and returns the current class instance. If *value* is not specified, returns the current hover method. | ||
<a name="Legend.id" href="#Legend.id">#</a> Legend.**id**([*value*]) [<>](https://github.com/d3plus/d3plus-legend/blob/master/src/Legend.js#L452) | ||
<a name="Legend.id" href="#Legend.id">#</a> Legend.**id**([*value*]) [<>](https://github.com/d3plus/d3plus-legend/blob/master/src/Legend.js#L456) | ||
@@ -453,3 +453,3 @@ If *value* is specified, sets the id accessor to the specified function and returns the current class instance. If *value* is not specified, returns the current id accessor. | ||
<a name="Legend.label" href="#Legend.label">#</a> Legend.**label**([*value*]) [<>](https://github.com/d3plus/d3plus-legend/blob/master/src/Legend.js#L462) | ||
<a name="Legend.label" href="#Legend.label">#</a> Legend.**label**([*value*]) [<>](https://github.com/d3plus/d3plus-legend/blob/master/src/Legend.js#L466) | ||
@@ -462,3 +462,3 @@ If *value* is specified, sets the label accessor to the specified function or string and returns the current class instance. If *value* is not specified, returns the current label accessor, which is the [id](#shape.id) accessor by default. | ||
<a name="Legend.outerBounds" href="#Legend.outerBounds">#</a> Legend.**outerBounds**() [<>](https://github.com/d3plus/d3plus-legend/blob/master/src/Legend.js#L472) | ||
<a name="Legend.outerBounds" href="#Legend.outerBounds">#</a> Legend.**outerBounds**() [<>](https://github.com/d3plus/d3plus-legend/blob/master/src/Legend.js#L476) | ||
@@ -476,3 +476,3 @@ If called after the elements have been drawn to DOM, will returns the outer bounds of the legend content. | ||
<a name="Legend.padding" href="#Legend.padding">#</a> Legend.**padding**([*value*]) [<>](https://github.com/d3plus/d3plus-legend/blob/master/src/Legend.js#L482) | ||
<a name="Legend.padding" href="#Legend.padding">#</a> Legend.**padding**([*value*]) [<>](https://github.com/d3plus/d3plus-legend/blob/master/src/Legend.js#L486) | ||
@@ -485,3 +485,3 @@ If *value* is specified, sets the padding between each key to the specified number and returns the current class instance. If *value* is not specified, returns the current padding value. | ||
<a name="Legend.select" href="#Legend.select">#</a> Legend.**select**([*selector*]) [<>](https://github.com/d3plus/d3plus-legend/blob/master/src/Legend.js#L492) | ||
<a name="Legend.select" href="#Legend.select">#</a> Legend.**select**([*selector*]) [<>](https://github.com/d3plus/d3plus-legend/blob/master/src/Legend.js#L496) | ||
@@ -494,3 +494,3 @@ If *selector* is specified, sets the SVG container element to the specified d3 selector or DOM element and returns the current class instance. If *selector* is not specified, returns the current SVG container element. | ||
<a name="Legend.shape" href="#Legend.shape">#</a> Legend.**shape**([*value*]) [<>](https://github.com/d3plus/d3plus-legend/blob/master/src/Legend.js#L502) | ||
<a name="Legend.shape" href="#Legend.shape">#</a> Legend.**shape**([*value*]) [<>](https://github.com/d3plus/d3plus-legend/blob/master/src/Legend.js#L506) | ||
@@ -503,3 +503,3 @@ If *value* is specified, sets the shape accessor to the specified function or string and returns the current class instance. If *value* is not specified, returns the current shape accessor. | ||
<a name="Legend.shapeConfig" href="#Legend.shapeConfig">#</a> Legend.**shapeConfig**([*config*]) [<>](https://github.com/d3plus/d3plus-legend/blob/master/src/Legend.js#L512) | ||
<a name="Legend.shapeConfig" href="#Legend.shapeConfig">#</a> Legend.**shapeConfig**([*config*]) [<>](https://github.com/d3plus/d3plus-legend/blob/master/src/Legend.js#L516) | ||
@@ -512,3 +512,3 @@ If *config* is specified, sets the methods that correspond to the key/value pairs for each shape and returns the current class instance. If *config* is not specified, returns the current shape configuration. | ||
<a name="Legend.title" href="#Legend.title">#</a> Legend.**title**([*value*]) [<>](https://github.com/d3plus/d3plus-legend/blob/master/src/Legend.js#L522) | ||
<a name="Legend.title" href="#Legend.title">#</a> Legend.**title**([*value*]) [<>](https://github.com/d3plus/d3plus-legend/blob/master/src/Legend.js#L526) | ||
@@ -521,3 +521,3 @@ If *value* is specified, sets the title of the legend and returns the current class instance. If *value* is not specified, returns the current title. | ||
<a name="Legend.titleConfig" href="#Legend.titleConfig">#</a> Legend.**titleConfig**([*value*]) [<>](https://github.com/d3plus/d3plus-legend/blob/master/src/Legend.js#L532) | ||
<a name="Legend.titleConfig" href="#Legend.titleConfig">#</a> Legend.**titleConfig**([*value*]) [<>](https://github.com/d3plus/d3plus-legend/blob/master/src/Legend.js#L536) | ||
@@ -530,3 +530,3 @@ If *value* is specified, sets the title configuration of the legend and returns the current class instance. If *value* is not specified, returns the current title configuration. | ||
<a name="Legend.verticalAlign" href="#Legend.verticalAlign">#</a> Legend.**verticalAlign**([*value*]) [<>](https://github.com/d3plus/d3plus-legend/blob/master/src/Legend.js#L542) | ||
<a name="Legend.verticalAlign" href="#Legend.verticalAlign">#</a> Legend.**verticalAlign**([*value*]) [<>](https://github.com/d3plus/d3plus-legend/blob/master/src/Legend.js#L546) | ||
@@ -539,3 +539,3 @@ If *value* is specified, sets the vertical alignment to the specified value and returns the current class instance. If *value* is not specified, returns the current vertical alignment. | ||
<a name="Legend.width" href="#Legend.width">#</a> Legend.**width**([*value*]) [<>](https://github.com/d3plus/d3plus-legend/blob/master/src/Legend.js#L552) | ||
<a name="Legend.width" href="#Legend.width">#</a> Legend.**width**([*value*]) [<>](https://github.com/d3plus/d3plus-legend/blob/master/src/Legend.js#L556) | ||
@@ -551,2 +551,2 @@ If *value* is specified, sets the overall width of the legend and returns the current class instance. If *value* is not specified, returns the current width value. | ||
###### <sub>Documentation generated on Tue, 02 Feb 2021 21:28:36 GMT</sub> | ||
###### <sub>Documentation generated on Thu, 11 Feb 2021 15:48:11 GMT</sub> |
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
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
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
1779264
42519
10
Updatedd3plus-common@^1.0.2
Updatedd3plus-shape@^1.0.3