This project visualizes the Iris dataset as a series of linked histograms using React and D3.
sepal_length, sepal_width, petal_length,
petal_widthuseState tracks
the current brush intervals for each column; useEffect
re-runs the D3 rendering logic whenever dimensions or
brush state change.ResizeObserver hook (useResizeObserver) watches
the container <div> and stores its pixel dimensions in
React state, causing the chart to re-render responsively
whenever the window is resized.useEffect, D3 selects
the <svg> element via a React ref and draws one
<g class="histogram"> per column. Each histogram is
rendered by the histogram() function in histogram.js.brushedIntervals is a plain
object mapping column name → [min, max]. The filtered
dataset is recomputed on every render by checking each
data row against every active interval.| File | Purpose |
|---|---|
index.html |
HTML shell with import map |
index.jsx |
React app entry point; state, resize hook, D3 orchestration |
histogram.js |
Pure D3 function that draws a single brushable histogram |