Repository navigation
Conversation
Lets a table show readable labels in place of raw column names, matching the header option of the Observable Inputs table. Closes uwdata#1408. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
kasivisu4
requested review from
dangotbanned,
domoritz and
jheer
as code owners
November 24, 2026 03:30
Match the rule table cells already use for formatted values: an HTMLElement or SVGElement is appended, and anything else is shown as text. A DocumentFragment label was emptied on the first render, and a Document or Attr label threw while building the header. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Why
The
tableinput shows raw column names in its header row, so a table overdep_delaycannot say "Departure delay (min)". Closes #1408. Thetablein@observablehq/inputshas the sameheaderoption.What changed
packages/vgplot/inputs/src/Table.jsheaderoption. It maps a column name to a label, either a string or an HTML or SVG element.packages/vgplot/spec/src/spec/Input.tsheader?: { [column: string]: string }on theTablespec type, so YAML and JSON specs can set it.packages/vgplot/vgplot-python/vgplot/plot.pyheaderargument onvg.table_input.docs/api/inputs/table.mdpackages/vgplot/inputs/test/table.test.jsThe core of the change is the label lookup in
Table.prepare():Usage:
Scope
A label changes only the header text. Sorting,
align,width,format, and the output selection still use the column name.Notes
Object.hasOwnis used instead ofin, so a column namedconstructorshows its own name.nullorundefinedlabel falls back to the column name.formatcells: anHTMLElementorSVGElementis appended as is, and any other value is shown as text. An element is moved, not cloned, so the docs say to use one element per column.headerrender exactly as before.Verification
pnpm test(936 passed),pnpm lint,pnpm docs:build, ruff, and the vgplot-python tests pass.pnpm devwith a YAML spec, ESM mode, and the JavaScript API, and withvg.table_input(...).to_json()in Python.🤖 Generated with Claude Code