Skip to main content
100%

Fork of React + D3 Hooks template

✓ Published0🌍 Public
SSatpreet Makhija
Last edited Jun 15, 2021
Created on Jun 15, 2021

This example shows a scatterplot of students' eye colors, encoded as colored circles positioned by their red and green color components, with circle radius representing the blue component. The visualization loads JSON data from a GitHub gist and renders with React and D3 v5, using React hooks such as `useRef` and `useEffect` to integrate D3's data-join and transitions. Circles initially appear at raw coordinates, then animate to scaled positions via `d3.scaleLinear`, `transition.attr`, and `d3.easeBounce`. The D3 selection is made on a React-managed `<g>` element, demonstrating hybrid React-D3 component composition.

AI-generated description

React + D3

Purpose

To provide an understandable React + D3 template. This version uses the new React hooks.

Trying to adapt using this

Questions

  • How can a wrapped element get the id of the wrapper element?
  • How does it work when we want to update the graph
MIT Licensed

Similar vizzes