0.0.27 • Published 6 years ago

react-d3-legends v0.0.27

Weekly downloads
30
License
MIT
Repository
github
Last release
6 years ago

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

6 years ago

0.0.26

6 years ago

0.0.24

6 years ago

0.0.23

6 years ago

0.0.22

6 years ago

0.0.20

6 years ago

0.0.19

6 years ago

0.0.18

6 years ago

0.0.17

6 years ago

0.0.16

6 years ago

0.0.15

6 years ago

0.0.14

6 years ago

0.0.12

6 years ago

0.0.11

6 years ago

0.0.10

6 years ago

0.0.9

6 years ago

0.0.8

6 years ago

0.0.7

6 years ago

0.0.6

6 years ago

0.0.5

6 years ago

0.0.4

6 years ago

0.0.3

6 years ago

0.0.21

6 years ago

0.0.2

6 years ago

0.0.1

6 years ago