@vx/legend
Advanced tools
Comparing version 0.0.182 to 0.0.183
{ | ||
"name": "@vx/legend", | ||
"version": "0.0.182", | ||
"version": "0.0.183", | ||
"description": "vx legend", | ||
@@ -17,3 +17,4 @@ "sideEffects": false, | ||
"prepublish": "npm run build", | ||
"test": "jest" | ||
"test": "jest", | ||
"docs": "cd ./docs && ../../../node_modules/.bin/react-docgen ../src/{legends,shapes} | ../../../scripts/buildDocs.sh" | ||
}, | ||
@@ -83,3 +84,3 @@ "repository": { | ||
"dependencies": { | ||
"@vx/group": "0.0.182", | ||
"@vx/group": "0.0.183", | ||
"classnames": "^2.2.5", | ||
@@ -86,0 +87,0 @@ "prop-types": "^15.5.10" |
295
Readme.md
# @vx/legend | ||
``` | ||
npm install --save @vx/legend | ||
``` | ||
<a title="@vx/legend npm downloads" href="https://www.npmjs.com/package/@vx/legend"> | ||
<img src="https://img.shields.io/npm/dm/@vx/legend.svg?style=flat-square" /> | ||
</a> | ||
Legends associate shapes and colors to data. | ||
```js | ||
// legends for linear scales | ||
import { LegendLinear } from '@vx/legend'; | ||
// legends for quantile scales | ||
import { LegendQuantile } from '@vx/legend'; | ||
// legends for ordinal scales | ||
import { LegendOrdinal } from '@vx/legend'; | ||
// legends for size scales | ||
import { LegendSize } from '@vx/legend'; | ||
// legends for threshold scales | ||
import { LegendThreshold } from '@vx/legend'; | ||
// custom legends | ||
import { Legend } from '@vx/legend'; | ||
``` | ||
## API | ||
#### LegendLinear | ||
#### LegendQuantile | ||
#### LegendOrdinal | ||
#### LegendThreshold | ||
#### LegendSize | ||
#### Legend | ||
## Example | ||
@@ -47,10 +17,3 @@ | ||
domain: [0.02, 0.04, 0.06, 0.08, 0.1], | ||
range: [ | ||
'#f2f0f7', | ||
'#dadaeb', | ||
'#bcbddc', | ||
'#9e9ac8', | ||
'#756bb1', | ||
'#54278f', | ||
], | ||
range: ['#f2f0f7', '#dadaeb', '#bcbddc', '#9e9ac8', '#756bb1', '#54278f'] | ||
}); | ||
@@ -72,2 +35,250 @@ | ||
} | ||
``` | ||
``` | ||
## Installation | ||
``` | ||
npm install --save @vx/legend | ||
``` | ||
## Components | ||
- [Legend](#legend-) | ||
- [LegendItem](#legenditem-) | ||
- [LegendLabel](#legendlabel-) | ||
- [LegendShape](#legendshape-) | ||
- [Linear](#linear-) | ||
- [Ordinal](#ordinal-) | ||
- [Quantile](#quantile-) | ||
- [Size](#size-) | ||
- [Threshold](#threshold-) | ||
- [Circle](#circle-) | ||
- [Rect](#rect-) | ||
## API | ||
<h3 id="legend-"><Legend /></h3> | ||
<a id="#Legend__children" name="Legend__children" href="#Legend__children">#</a> *Legend*.**children**<func> | ||
<a id="#Legend__className" name="Legend__className" href="#Legend__className">#</a> *Legend*.**className**<string> | ||
<a id="#Legend__direction" name="Legend__direction" href="#Legend__direction">#</a> *Legend*.**direction**<string> <table><tr><td><strong>Default</strong></td><td>'column'</td></td></table> | ||
<a id="#Legend__domain" name="Legend__domain" href="#Legend__domain">#</a> *Legend*.**domain**<array> | ||
<a id="#Legend__fill" name="Legend__fill" href="#Legend__fill">#</a> *Legend*.**fill**<any> <table><tr><td><strong>Default</strong></td><td>valueOrIdentity</td></td></table> | ||
<a id="#Legend__itemDirection" name="Legend__itemDirection" href="#Legend__itemDirection">#</a> *Legend*.**itemDirection**<string> <table><tr><td><strong>Default</strong></td><td>'row'</td></td></table> | ||
<a id="#Legend__itemMargin" name="Legend__itemMargin" href="#Legend__itemMargin">#</a> *Legend*.**itemMargin**<string> <table><tr><td><strong>Default</strong></td><td>'0'</td></td></table> | ||
<a id="#Legend__labelAlign" name="Legend__labelAlign" href="#Legend__labelAlign">#</a> *Legend*.**labelAlign**<string> <table><tr><td><strong>Default</strong></td><td>'left'</td></td></table> | ||
<a id="#Legend__labelFlex" name="Legend__labelFlex" href="#Legend__labelFlex">#</a> *Legend*.**labelFlex**<string> <table><tr><td><strong>Default</strong></td><td>'1'</td></td></table> | ||
<a id="#Legend__labelFormat" name="Legend__labelFormat" href="#Legend__labelFormat">#</a> *Legend*.**labelFormat**<func> <table><tr><td><strong>Default</strong></td><td>valueOrIdentity</td></td></table> | ||
<a id="#Legend__labelMargin" name="Legend__labelMargin" href="#Legend__labelMargin">#</a> *Legend*.**labelMargin**<string> <table><tr><td><strong>Default</strong></td><td>'0 4px'</td></td></table> | ||
<a id="#Legend__labelTransform" name="Legend__labelTransform" href="#Legend__labelTransform">#</a> *Legend*.**labelTransform**<func> <table><tr><td><strong>Default</strong></td><td>function defaultTransform({ scale, labelFormat }) { | ||
return (d, i) => { | ||
return { | ||
datum: d, | ||
index: i, | ||
text: `${labelFormat(d, i)}`, | ||
value: scale(d) | ||
}; | ||
}; | ||
}</td></td></table> | ||
<a id="#Legend__scale" name="Legend__scale" href="#Legend__scale">#</a> *Legend*.**scale**<union(func|object)> `required` | ||
<a id="#Legend__shape" name="Legend__shape" href="#Legend__shape">#</a> *Legend*.**shape**<any> | ||
<a id="#Legend__shapeHeight" name="Legend__shapeHeight" href="#Legend__shapeHeight">#</a> *Legend*.**shapeHeight**<union(number|string)> <table><tr><td><strong>Default</strong></td><td>15</td></td></table> | ||
<a id="#Legend__shapeMargin" name="Legend__shapeMargin" href="#Legend__shapeMargin">#</a> *Legend*.**shapeMargin**<any> <table><tr><td><strong>Default</strong></td><td>'2px 4px 2px 0'</td></td></table> | ||
<a id="#Legend__shapeStyle" name="Legend__shapeStyle" href="#Legend__shapeStyle">#</a> *Legend*.**shapeStyle**<any> | ||
<a id="#Legend__shapeWidth" name="Legend__shapeWidth" href="#Legend__shapeWidth">#</a> *Legend*.**shapeWidth**<union(number|string)> <table><tr><td><strong>Default</strong></td><td>15</td></td></table> | ||
<a id="#Legend__size" name="Legend__size" href="#Legend__size">#</a> *Legend*.**size**<any> <table><tr><td><strong>Default</strong></td><td>valueOrIdentity</td></td></table> | ||
<a id="#Legend__style" name="Legend__style" href="#Legend__style">#</a> *Legend*.**style**<any> <table><tr><td><strong>Default</strong></td><td>{ | ||
display: 'flex' | ||
}</td></td></table> | ||
<h3 id="legenditem-"><LegendItem /></h3> | ||
<a id="#LegendItem__alignItems" name="LegendItem__alignItems" href="#LegendItem__alignItems">#</a> *LegendItem*.**alignItems**<string> <table><tr><td><strong>Default</strong></td><td>'center'</td></td></table> | ||
<a id="#LegendItem__children" name="LegendItem__children" href="#LegendItem__children">#</a> *LegendItem*.**children**<any> | ||
<a id="#LegendItem__display" name="LegendItem__display" href="#LegendItem__display">#</a> *LegendItem*.**display** <table><tr><td><strong>Default</strong></td><td>'flex'</td></td></table> | ||
<a id="#LegendItem__flexDirection" name="LegendItem__flexDirection" href="#LegendItem__flexDirection">#</a> *LegendItem*.**flexDirection**<string> <table><tr><td><strong>Default</strong></td><td>'row'</td></td></table> | ||
<a id="#LegendItem__margin" name="LegendItem__margin" href="#LegendItem__margin">#</a> *LegendItem*.**margin**<union(string|number)> <table><tr><td><strong>Default</strong></td><td>'0'</td></td></table> | ||
<h3 id="legendlabel-"><LegendLabel /></h3> | ||
<a id="#LegendLabel__align" name="LegendLabel__align" href="#LegendLabel__align">#</a> *LegendLabel*.**align**<string> <table><tr><td><strong>Default</strong></td><td>'left'</td></td></table> | ||
<a id="#LegendLabel__children" name="LegendLabel__children" href="#LegendLabel__children">#</a> *LegendLabel*.**children**<any> | ||
<a id="#LegendLabel__flex" name="LegendLabel__flex" href="#LegendLabel__flex">#</a> *LegendLabel*.**flex**<union(string|number)> <table><tr><td><strong>Default</strong></td><td>'1'</td></td></table> | ||
<a id="#LegendLabel__label" name="LegendLabel__label" href="#LegendLabel__label">#</a> *LegendLabel*.**label**<any> | ||
<a id="#LegendLabel__margin" name="LegendLabel__margin" href="#LegendLabel__margin">#</a> *LegendLabel*.**margin**<union(string|number)> <table><tr><td><strong>Default</strong></td><td>'5px 0'</td></td></table> | ||
<h3 id="legendshape-"><LegendShape /></h3> | ||
<a id="#LegendShape__fill" name="LegendShape__fill" href="#LegendShape__fill">#</a> *LegendShape*.**fill**<any> | ||
<a id="#LegendShape__height" name="LegendShape__height" href="#LegendShape__height">#</a> *LegendShape*.**height**<any> | ||
<a id="#LegendShape__label" name="LegendShape__label" href="#LegendShape__label">#</a> *LegendShape*.**label**<any> | ||
<a id="#LegendShape__margin" name="LegendShape__margin" href="#LegendShape__margin">#</a> *LegendShape*.**margin**<any> | ||
<a id="#LegendShape__shape" name="LegendShape__shape" href="#LegendShape__shape">#</a> *LegendShape*.**shape**<any> <table><tr><td><strong>Default</strong></td><td>ShapeRect</td></td></table> | ||
<a id="#LegendShape__shapeStyle" name="LegendShape__shapeStyle" href="#LegendShape__shapeStyle">#</a> *LegendShape*.**shapeStyle**<any> | ||
<a id="#LegendShape__size" name="LegendShape__size" href="#LegendShape__size">#</a> *LegendShape*.**size**<any> | ||
<a id="#LegendShape__width" name="LegendShape__width" href="#LegendShape__width">#</a> *LegendShape*.**width**<any> | ||
<h3 id="linear-"><Linear /></h3> | ||
<a id="#Linear__domain" name="Linear__domain" href="#Linear__domain">#</a> *Linear*.**domain**<array> | ||
<a id="#Linear__labelFormat" name="Linear__labelFormat" href="#Linear__labelFormat">#</a> *Linear*.**labelFormat**<func> <table><tr><td><strong>Default</strong></td><td>x => x</td></td></table> | ||
<a id="#Linear__labelTransform" name="Linear__labelTransform" href="#Linear__labelTransform">#</a> *Linear*.**labelTransform**<func> <table><tr><td><strong>Default</strong></td><td>function defaultTransform({ scale, labelFormat }) { | ||
return (d, i) => { | ||
return { | ||
text: `${labelFormat(d, i)}`, | ||
value: scale(d) | ||
}; | ||
}; | ||
}</td></td></table> | ||
<a id="#Linear__scale" name="Linear__scale" href="#Linear__scale">#</a> *Linear*.**scale**<func> `required` | ||
<a id="#Linear__steps" name="Linear__steps" href="#Linear__steps">#</a> *Linear*.**steps**<number> <table><tr><td><strong>Default</strong></td><td>5</td></td></table> | ||
<h3 id="ordinal-"><Ordinal /></h3> | ||
<a id="#Ordinal__domain" name="Ordinal__domain" href="#Ordinal__domain">#</a> *Ordinal*.**domain**<array> | ||
<a id="#Ordinal__labelFormat" name="Ordinal__labelFormat" href="#Ordinal__labelFormat">#</a> *Ordinal*.**labelFormat**<func> <table><tr><td><strong>Default</strong></td><td>valueOrIdentity</td></td></table> | ||
<a id="#Ordinal__labelTransform" name="Ordinal__labelTransform" href="#Ordinal__labelTransform">#</a> *Ordinal*.**labelTransform**<func> <table><tr><td><strong>Default</strong></td><td>function defaultTransform({ scale, labelFormat }) { | ||
return (d, i) => { | ||
return { | ||
datum: d, | ||
index: i, | ||
text: `${labelFormat(d, i)}`, | ||
value: scale(d) | ||
}; | ||
}; | ||
}</td></td></table> | ||
<a id="#Ordinal__scale" name="Ordinal__scale" href="#Ordinal__scale">#</a> *Ordinal*.**scale**<func> `required` | ||
<h3 id="quantile-"><Quantile /></h3> | ||
<a id="#Quantile__domain" name="Quantile__domain" href="#Quantile__domain">#</a> *Quantile*.**domain**<array> | ||
<a id="#Quantile__labelDelimiter" name="Quantile__labelDelimiter" href="#Quantile__labelDelimiter">#</a> *Quantile*.**labelDelimiter**<string> <table><tr><td><strong>Default</strong></td><td>'-'</td></td></table> | ||
<a id="#Quantile__labelFormat" name="Quantile__labelFormat" href="#Quantile__labelFormat">#</a> *Quantile*.**labelFormat**<func> <table><tr><td><strong>Default</strong></td><td>x => x</td></td></table> | ||
<a id="#Quantile__labelTransform" name="Quantile__labelTransform" href="#Quantile__labelTransform">#</a> *Quantile*.**labelTransform**<func> | ||
<a id="#Quantile__scale" name="Quantile__scale" href="#Quantile__scale">#</a> *Quantile*.**scale**<func> `required` | ||
<h3 id="size-"><Size /></h3> | ||
<a id="#Size__labelFormat" name="Size__labelFormat" href="#Size__labelFormat">#</a> *Size*.**labelFormat** <table><tr><td><strong>Default</strong></td><td>x => x</td></td></table> | ||
<a id="#Size__labelTransform" name="Size__labelTransform" href="#Size__labelTransform">#</a> *Size*.**labelTransform** <table><tr><td><strong>Default</strong></td><td>function defaultTransform({ scale, labelFormat }) { | ||
return (d, i) => { | ||
return { | ||
text: `${labelFormat(d, i)}`, | ||
value: scale(d), | ||
datum: d, | ||
index: i | ||
}; | ||
}; | ||
}</td></td></table> | ||
<a id="#Size__steps" name="Size__steps" href="#Size__steps">#</a> *Size*.**steps** <table><tr><td><strong>Default</strong></td><td>5</td></td></table> | ||
<h3 id="threshold-"><Threshold /></h3> | ||
<a id="#Threshold__domain" name="Threshold__domain" href="#Threshold__domain">#</a> *Threshold*.**domain**<array> | ||
<a id="#Threshold__labelDelimiter" name="Threshold__labelDelimiter" href="#Threshold__labelDelimiter">#</a> *Threshold*.**labelDelimiter**<string> <table><tr><td><strong>Default</strong></td><td>'to'</td></td></table> | ||
<a id="#Threshold__labelFormat" name="Threshold__labelFormat" href="#Threshold__labelFormat">#</a> *Threshold*.**labelFormat**<func> <table><tr><td><strong>Default</strong></td><td>x => x</td></td></table> | ||
<a id="#Threshold__labelLower" name="Threshold__labelLower" href="#Threshold__labelLower">#</a> *Threshold*.**labelLower**<string> <table><tr><td><strong>Default</strong></td><td>'Less than '</td></td></table> | ||
<a id="#Threshold__labelTransform" name="Threshold__labelTransform" href="#Threshold__labelTransform">#</a> *Threshold*.**labelTransform**<func> | ||
<a id="#Threshold__labelUpper" name="Threshold__labelUpper" href="#Threshold__labelUpper">#</a> *Threshold*.**labelUpper**<string> <table><tr><td><strong>Default</strong></td><td>'More than '</td></td></table> | ||
<a id="#Threshold__scale" name="Threshold__scale" href="#Threshold__scale">#</a> *Threshold*.**scale**<func> `required` | ||
<h3 id="circle-"><Circle /></h3> | ||
<a id="#Circle__fill" name="Circle__fill" href="#Circle__fill">#</a> *Circle*.**fill**<any> | ||
<a id="#Circle__height" name="Circle__height" href="#Circle__height">#</a> *Circle*.**height**<union(number|string)> | ||
<a id="#Circle__style" name="Circle__style" href="#Circle__style">#</a> *Circle*.**style**<object> | ||
<a id="#Circle__width" name="Circle__width" href="#Circle__width">#</a> *Circle*.**width**<union(number|string)> | ||
<h3 id="rect-"><Rect /></h3> | ||
<a id="#Rect__fill" name="Rect__fill" href="#Rect__fill">#</a> *Rect*.**fill**<any> | ||
<a id="#Rect__height" name="Rect__height" href="#Rect__height">#</a> *Rect*.**height**<union(number|string)> | ||
<a id="#Rect__style" name="Rect__style" href="#Rect__style">#</a> *Rect*.**style**<object> | ||
<a id="#Rect__width" name="Rect__width" href="#Rect__width">#</a> *Rect*.**width**<union(number|string)> |
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
85932
283
+ Added@vx/group@0.0.183(transitive)
- Removed@vx/group@0.0.182(transitive)
Updated@vx/group@0.0.183