Skip to content

About

Charts of my favorite books. Built with Next.js, visx, d3

Resources

Stars

0 stars

Watchers

0 watching

Forks

Repository files navigation

book-charts

Interactive, hand-drawn-style charts that visualize the structure of novels — one route per chapter, built with React and SVG.

The first book in the library is Antonio Muñoz Molina's Sepharad, a novel told across 17 loosely-connected chapters that shift between narrators, timelines, and registers of memory. Each chapter gets a bespoke diagram of whatever structural idea makes that chapter distinctive — a present/past timeline, a character web, a page-position map — rather than forcing every chapter into one chart type.

Live demo

pnpm dev and visit /sepharad for the book index, or jump straight to /sepharad/sacristan for chapter 1 (the first fully working example — scroll to watch its timeline draw in).

Why

Novels like this one are hard to hold in your head — who's narrating, when, and how sure we are about any of it. These charts are reading notes made visual: partly a personal tool for tracking a book's structure while reading it, partly an experiment in whether hand-drawn-feeling data viz can carry literary ambiguity as well as prose can.

Design conventions

  • Solid vs. dashed — solid lines/shapes mean concrete or symmetric relationships in the text; dashed means inferred or asymmetric.
  • The "uncertain" badge — a dashed outline with a "?" marker and tooltip, used when my own transcription/interpretation of the text is unverified. This is distinct from ambiguity the author put there deliberately, which is rendered as normal (if dashed) content rather than flagged.
  • Rough, not slick — charts use rough.js styling and hand-drawn motifs (squiggles, sketchy strokes) instead of clean vector lines, matching the feel of marginalia and reading notes.
  • Scroll and interaction as narrative — charts animate in via scroll position (Framer Motion) or reveal detail on hover/click, so each chapter reads like a small piece of continuous scroll rather than a static figure.

Stack

  • Next.js 16 (App Router) + React 19 + TypeScript
  • Tailwind CSS 4 for layout and type
  • visx + d3-shape for scales, curves, and axis primitives
  • Framer Motion for scroll-driven and route-transition animation
  • rough.js for the hand-drawn rendering style
  • Vitest + Testing Library for tests

Structure

Every book gets its own namespace under app/, data/, and components/chapters/, so a second book can be added without touching the first.

app/
  page.tsx                     library index — links to each book
  sepharad/
    page.tsx                   book intro — title, author, chapter list
    layout.tsx                 mounts the scroll-reset/transition shell
    [slug]/
      page.tsx                 dynamic chapter route
      chapterRegistry.ts       maps chapter slug -> chart component

components/
  toolkit/                     shared, book-agnostic SVG primitives
                                (AxisLine, Arrow, Dot, Bar, Uncertain badge,
                                 curve/squiggle path helpers, style tokens)
  nav/                         chapter nav bar + page-transition wrapper
  chapters/sepharad/           one bespoke chart component per chapter
                                (e.g. 01-sacristan.tsx)

data/
  sepharad/
    book.ts                    book metadata + ordered chapter list
    chapters/                  per-chapter structured data
                                (e.g. 01-sacristan.ts — timeline segments,
                                 quotes, flagged-uncertain fields)

lib/
  scale.ts, styleTokens.ts, useScrollDraw.ts, schema.ts   shared utilities

Adding a chapter to an existing book: add its data file under data/<book>/chapters/, add a component under components/chapters/<book>/, then register it in app/<book>/[slug]/chapterRegistry.ts.

Adding a new book: mirror the sepharad/ namespace under app/, data/, and components/chapters/, then link it from the library index at app/page.tsx. The components/toolkit/ primitives and lib/ utilities are shared across all books.

Data conventions

Any transcribed value that hasn't been double-checked against the source text is wrapped as MaybeUncertain<T> ({ value, uncertain: true }) rather than asserted as fact, and rendered with the "uncertain" badge described above. This keeps my own note-taking errors visually distinct from the novel's actual ambiguity.

Commands

pnpm dev      # dev server at localhost:3000
pnpm build    # typecheck + production build
pnpm test     # run the test suite (vitest)
pnpm lint     # eslint

Status

17 chapters are scaffolded with data and nav; chapter 1 ("sacristan") is the first fully wired vertical slice — data, chart, scroll-driven animation, and the uncertain-badge pattern all working end-to-end. The remaining chapters are being built out incrementally, one interaction pattern (scroll, hover/click, parametric) at a time.

About

Charts of my favorite books. Built with Next.js, visx, d3

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages