brush hook with a nice api to brush and filter your chart data
npm i -S react-use-brush
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>
</>
);
};
npm i
npm build
npm test
👤 DavidSanwald
- Website: https://www.davidsanwald.net/
- Twitter: @DavidSanwald
- Github: @DavidSanwald
Give a ⭐️ if this project helped you!
Copyright © 2019 DavidSanwald.
This project is MIT licensed.