Skip to content

Lead the README with a themed light/dark recording of the example - #297

Merged
Alek99 merged 9 commits into
mainfrom
alek/readme-motion
Jul 25, 2026
Merged

Lead the README with a themed light/dark recording of the example#297
Alek99 merged 9 commits into
mainfrom
alek/readme-motion

Conversation

@Alek99

@Alek99 Alek99 commented Jul 25, 2026

Copy link
Copy Markdown
Member

The README sells an interactive charting library with only static images. The
getting-started section now leads with a real recording of its own example being
panned, zoomed, and hovered, and the header gains an explicit link to the live
docs demo — previously that demo was reachable only through a generic
"documentation" link. The XY logo stays where it was.

Getting started now exercises the large-data path

The first snippet built a six-point revenue chart, which matplotlib does fine
and which quietly undercuts the "built for large data" highlight. It now builds
two million points from the standard library:

rng = random.Random(7)
n = 1_000_000

def walk() -> list[float]:
    return list(itertools.accumulate(rng.gauss(0.0, 1.0) for _ in range(n)))

No numpy, builds in ~0.6 s. Both traces take the decimated tier and reach the
browser as a measured 54.0 KB payload (52.3 KB blob + 1.6 KB spec JSON)
rather than two million JSON numbers — the number in the prose comes from
measurement, per §2.

Light and dark

The recordings are served through a <picture> element keyed on
prefers-color-scheme, so the GIF follows the reader's GitHub theme and each
visitor downloads only one. The dark chart sits on #0d1117 — GitHub's own dark
canvas — so it blends into the page instead of glaring, and carries the client's
dark chrome (class_name="dark"; the dark modebar/tooltip key off that class,
not the media query).

Series colors moved from blue/green to the validated categorical slots
blue #2a78d6 / orange #eb6834 (dark: #3987e5 / #d95926). Blue/green sat
too close for red-green colorblind readers; the new pair measures ΔE 24.7 under
protanopia (≥8 target) and 33.6 unsimulated (≥15 floor), passing on both
surfaces.

Also in this PR

  • Installation is trimmed to the two install commands — the wheel-contents
    paragraph and the Pyodide/micropip walkthrough are gone.
  • Benchmarks now sits below Getting started (after the matplotlib
    subsection), so the reader meets the API before the numbers.

Notes for review

  • The recorded chart is built from the exact snippet the README prints, so the
    caption "the chart built by the example below" is literal. The hover frame
    shows the tooltip reading back an exact source row (x: 578852,
    y: 697.5602) from 2M points at 210% zoom.
  • Both GIFs loop seamlessly (last frame is pixel-identical to the first; the
    sequence ends on the chart's own double-click reset).
  • Repo grows ~7.5 MB (3.6 MB light + 3.9 MB dark). Happy to drop to ~820px or
    ship light-only if that is too much.

ruff check, ruff format --check, scripts/check_claim_guardrails.py, and the
full pre-commit run --all-files all pass.

Summary by CodeRabbit

  • Documentation
    • Added a centered “Try it live: a million points in your browser →” link under the top XY banner.
    • Replaced the “Getting started” example with a seeded density-enabled scatter demo (hundred million points) and updated the accompanying dark-themed visuals and explanatory text, including drilldown replacing the surface with real rows.
    • Refreshed the described export behavior and updated the supported chart types list.
    • Moved the “Benchmarks” section to a later spot in the README with the same reference links and baseline.

The README sold an interactive product with a static image. Replace the hero
with a real recording of the getting-started chart being panned, zoomed, and
hovered, and put an explicit link to the live docs demo directly beneath it.

The getting-started example now builds two million points from the standard
library (seeded random walks) instead of six months of revenue, so the first
snippet exercises the large-data path the highlights claim. Both traces take
the decimated tier and reach the browser as a measured 54.0 KB payload.

Light and dark recordings are served through a <picture> element, so the GIF
follows the reader's GitHub theme; the dark chart sits on GitHub's own dark
canvas and carries the client's dark chrome. Series colors are the validated
categorical slots (blue/orange) rather than blue/green, which sat too close
together for red-green colorblind readers.

The recorded chart is built from the snippet the README prints, so the caption
describes the code exactly.
@coderabbitai

coderabbitai Bot commented Jul 25, 2026

Copy link
Copy Markdown

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: 53eb7ffc-b35b-4e70-b40b-9e652f0e09bb

📥 Commits

Reviewing files that changed from the base of the PR and between 8cac633 and 2473098.

⛔ Files ignored due to path filters (2)
  • spec/assets/xy-density-100m-dark.gif is excluded by !**/*.gif
  • spec/assets/xy-density-100m-light.gif is excluded by !**/*.gif
📒 Files selected for processing (1)
  • README.md
🚧 Files skipped from review as they are similar to previous changes (1)
  • README.md

📝 Walkthrough

Walkthrough

The README adds a live demo link, replaces the getting-started chart with a seeded 100-million-point density-surface example, updates related explanations, and moves the benchmarks section later in the document.

Changes

README refresh

Layer / File(s) Summary
Live demo banner link
README.md
A centered link to the live million-point browser demo is added below the hero image.
Density-surface getting-started example
README.md
The business chart is replaced with a seeded NumPy 100-million-point density demo and documentation for re-aggregation, drilldown, export, and payload behavior.
Benchmark section relocation
README.md
The existing benchmark content is removed from its earlier position and reintroduced later in the document.

Estimated code review effort: 1 (Trivial) | ~5 minutes

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly matches the main README change: featuring themed light/dark recordings of the example chart.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch alek/readme-motion

Comment @coderabbitai help to get the list of available commands.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 2

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@README.md`:
- Around line 8-10: Reconcile the live-demo link label with the surrounding
documentation’s 2,000,000-point claim: update the label to match the actual demo
count, or explicitly state that the linked demo uses one million points if that
is intentional.
- Around line 128-131: Update the README description near the payload-size claim
so the 54 KB figure is tied to a specific benchmark mode, dataset size, and
viewport using the harness’s payload_bytes output; if those benchmark details
are unavailable, remove the fixed 54 KB number and describe the payload
qualitatively instead.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: a3a58c40-6a8e-46fe-8d8e-f77a2c89847d

📥 Commits

Reviewing files that changed from the base of the PR and between a7239b9 and f2165bd.

⛔ Files ignored due to path filters (2)
  • spec/assets/xy-pan-zoom-2m-dark.gif is excluded by !**/*.gif
  • spec/assets/xy-pan-zoom-2m-light.gif is excluded by !**/*.gif
📒 Files selected for processing (1)
  • README.md

Comment thread README.md
Comment thread README.md Outdated
@codspeed-hq

codspeed-hq Bot commented Jul 25, 2026

Copy link
Copy Markdown

Merging this PR will not alter performance

✅ 102 untouched benchmarks
⏩ 2 skipped benchmarks1


Comparing alek/readme-motion (2473098) with main (a7239b9)

Open in CodSpeed

Footnotes

  1. 2 benchmarks were skipped, so the baseline results were used instead. If they were deleted from the codebase, click here and archive them to remove them from the performance reports.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 2

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@README.md`:
- Around line 49-50: Update the README image markup around the xy-density
recording to use a picture element with separate light and dark sources selected
via prefers-color-scheme, while retaining the existing GIF as the fallback image
and preserving its alt text and presentation attributes.
- Around line 47-84: Replace the README getting-started example’s NumPy-based
100,000,000-point spiral generator with the documented seeded standard-library
random-walk generator producing 2,000,000 points. Update the related imports,
data construction, and chart title to match that example, while preserving the
existing chart rendering configuration unless the documented example requires
otherwise.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: f1c86984-e588-4513-a8c0-ebaaed23cfa4

📥 Commits

Reviewing files that changed from the base of the PR and between a9be16b and 8cac633.

⛔ Files ignored due to path filters (1)
  • spec/assets/xy-density-100m.gif is excluded by !**/*.gif
📒 Files selected for processing (1)
  • README.md

Comment thread README.md
Comment on lines +47 to 84
Chart a hundred million points as a density surface:

```javascript
await pyodide.loadPackage("micropip");
```
<p align="center">
<img src="spec/assets/xy-density-100m.gif" alt="A hundred-million-point spiral rendered as a density surface, zoomed and panned; each view is re-aggregated by the engine." width="900">
</p>

```python
import micropip

await micropip.install("xy")
```

## Getting started

Create a small business chart:
import numpy as np

```python
import xy

months = [1, 2, 3, 4, 5, 6]
revenue = [42, 45, 48, 51, 55, 59]
pipeline = [35, 38, 42, 40, 46, 50]

chart = xy.line_chart(
xy.line(months, revenue, name="revenue", color="#2563eb"),
xy.line(months, pipeline, name="pipeline", color="#16a34a"),
xy.x_axis(label="month"),
xy.y_axis(label="USD thousands"),
xy.legend(),
title="Revenue vs pipeline",
rng = np.random.default_rng(7)
n = 100_000_000

r = 6.0 * rng.beta(1.2, 3.0, n)
theta = 2.9 * np.log1p(r) + rng.integers(0, 4, n) * (np.pi / 2) + rng.normal(0, 0.045 + 0.016 * r, n)

chart = xy.scatter_chart(
xy.scatter(
r * np.cos(theta),
r * np.sin(theta),
color=np.exp(-r / 2.2),
colormap="magma",
density=True,
opacity=0.3,
),
xy.theme(
background="#0d1117", plot_background="#0d1117", grid_color="#21262d",
axis_color="#30363d", text_color="#e6edf3",
),
title="100 million points",
class_name="dark",
)
# chart.to_html("chart.html")
# chart.to_png("chart.png")
# chart.to_svg("chart.svg")
chart
```

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🩺 Stability & Availability | 🟠 Major | 🏗️ Heavy lift

Align the getting-started example with the stated two-million-point standard-library demo.

This example now uses NumPy, a 100,000,000-point dataset, and a spiral distribution. The PR objective requires a seeded, standard-library random walk with 2,000,000 points. The current version also allocates multiple very large arrays and can require several GB of peak memory, making it unsuitable as a getting-started example.

Replace the generator and related copy/title with the documented two-million-point standard-library example.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@README.md` around lines 47 - 84, Replace the README getting-started example’s
NumPy-based 100,000,000-point spiral generator with the documented seeded
standard-library random-walk generator producing 2,000,000 points. Update the
related imports, data construction, and chart title to match that example, while
preserving the existing chart rendering configuration unless the documented
example requires otherwise.

Comment thread README.md Outdated
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant