Skip to content

DavidSanwald/react-use-brush

Repository files navigation

Welcome to react-use-brush 🖌

Build Status Version Documentation Maintenance License: MIT Twitter: DavidSanwald

brush hook with a nice api to brush and filter your chart data

Install

npm i -S react-use-brush

Usage

You can try a live demo here: https://codesandbox.io/s/nervous-rosalind-kfxeq

const Chart = () => {
  const [state, rect, rectRef, bind, selection] = useBrush();
  // ...

  return (
    <>
      <svg {...bind} width={width} height={height}>
        <rect
          {...rect}
          ref={rectRef}
          fill="none"
          stroke="black"
          pointerEvents="all"
        />
      </svg>
    </>
  );
};

Run tests

npm i
npm build
npm test

Author

👤 DavidSanwald

Show your 💚

Give a ⭐️ if this project helped you!

📝 License

Copyright © 2019 DavidSanwald.
This project is MIT licensed.