0.0.27 • Published 7 years ago
react-d3-legends v0.0.27
forked from @vx/legend and maintaining it for further usage.
npm install --save react-d3-legends
yarn add react-d3-legends
Legends associate shapes and colors to data.
// legends for linear scales
import { LegendLinear } from 'react-d3-legends';
// legends for quantile scales
import { LegendQuantile } from 'react-d3-legends';
// legends for ordinal scales
import { LegendOrdinal } from 'react-d3-legends';
// legends for size scales
import { LegendSize } from 'react-d3-legends';
// legends for threshold scales
import { LegendThreshold } from 'react-d3-legends';
// custom legends
import { Legend } from 'react-d3-legends';
API
LegendLinear
LegendQuantile
LegendOrdinal
LegendThreshold
LegendSize
Legend
supported Shapes: circle, square, rectangle, triangle-up, triangle-down, diamond, cross
Example
import { LegendThreshold } from '@vx/legend';
function MyChart() {
return (
<div>
<svg>{/** chart stuff */}</svg>
<div
style={{
width: "100%",
display: "flex",
justifyContent: "center",
fontSize: "14px"
}}
onClick={this.legendClick}
>
<Legend
scale={colorScale}
direction="row"
labelMargin="0 15px 0 0"
shape={customPointShape}
/>
</div>
</div>
);
}
0.0.27
7 years ago
0.0.26
7 years ago
0.0.24
7 years ago
0.0.23
7 years ago
0.0.22
7 years ago
0.0.20
7 years ago
0.0.19
7 years ago
0.0.18
7 years ago
0.0.17
7 years ago
0.0.16
7 years ago
0.0.15
7 years ago
0.0.14
7 years ago
0.0.12
7 years ago
0.0.11
7 years ago
0.0.10
7 years ago
0.0.9
7 years ago
0.0.8
7 years ago
0.0.7
7 years ago
0.0.6
7 years ago
0.0.5
7 years ago
0.0.4
7 years ago
0.0.3
7 years ago
0.0.21
7 years ago
0.0.2
7 years ago
0.0.1
7 years ago