Skip to content

Draw the trait sheet on the canvas, in the colours the figure would use - #54

Merged
Paururo merged 1 commit into
mainfrom
feat/tree-traits-on-canvas
Aug 30, 2026
Merged

Draw the trait sheet on the canvas, in the colours the figure would use#54
Paururo merged 1 commit into
mainfrom
feat/tree-traits-on-canvas

Conversation

@Paururo

@Paururo Paururo commented Aug 30, 2026

Copy link
Copy Markdown
Member

The last of the four things the Taxonium study said were clearly worth doing.
Dropping a trait sheet put --traits in the exported command and changed nothing
on the screen, so the picture a reader was looking at and the figure they were
about to save were different pictures.

The crate answers, the page draws

TreeTrack::strips(&theme) hands over the columns resolved the way a figure
resolves them: which level every node is at, and which colour that level got.
The wire carries both schemes, so a reader who switches to dark still sees the
crate's palette rather than one the page invented.

Working the levels out again from the sheet would be a second opinion about
which blue is which, and two pictures of one tree disagreeing about that is the
thing this page exists not to do. The resolution is the crate's own, including
the part where a branch takes what its tips agree on, which is how a sheet keyed
by sample name reaches an internal node at all.

A continuous column has no levels of its own, so it is given sixteen bands. That
is a choice the canvas makes and the SVG does not, which is why the bands are
named by the range they cover rather than pretending to be values.

What it looks like

Verified on a sixty tip outbreak with a three column sheet: place with five
categories, host with two, and depth continuous. The rectangular view draws
three columns of cells beside the tip names, the circular view draws them as
three rings outside the rim, and a key under the plot names every level with its
swatch. All three read the same colours.

A sheet is a thing to ask the program about now rather than a note kept on the
page, so dropping one asks for the layout again, and so does putting it down.

One real bug it turned up

where(node), which is what the hand uses to name what is under it, did not know
the columns had taken their width. It agreed with the paint before this change
and would have disagreed after it, naming a branch a little to the right of the
one under the pointer. Caught by a check that asks whether the strips took any
room at all.

Checks

51 in tests/tree-canvas.test.js, five of them new, plus three in the crate and
one on the wire. Painting every cell one colour fails one; giving a cell to a
node the sheet says nothing about fails another, which counts exactly the named
rows that carry a value; taking no room for the columns fails a third. In the
crate, giving every level the same colour fails one and stopping a branch
inheriting what its tips agree on fails another. On the wire, the check asserts
the colours that arrive are Theme::light().color(i) and Theme::dark().color(i)
in order, so the bridge cannot invent them.

Dropping a sheet put --traits in the exported command and changed nothing on
the screen, so the picture a reader was looking at and the figure they were
about to save were different pictures. The strips are on the canvas now, and
on the disc as the rings the crate draws there, with a key naming every level.

The colours are not chosen on the page. TreeTrack::strips hands over what the
figure would draw, which level every node is at and which colour that level
got, and the wire carries both schemes so a reader who switches to dark still
sees the crate's palette rather than one the page invented. Working the levels
out again from the sheet would be a second opinion about which blue is which,
and two pictures of one tree disagreeing about that is the thing this page
exists not to do. A continuous column has no levels of its own, so it is given
sixteen bands, which is a choice the canvas makes and the SVG does not, and it
is why the bands are named by the range they cover.

Where a node lands did not know about the columns, so the hand would have
named a branch a little to the right of the one under it.
@github-actions github-actions Bot added documentation Improvements or additions to documentation phylogenetics Trees, tanglegrams, clades and branch layers rendering The SVG writer, themes, layout and the visual system tests The test suites and the property net labels Aug 30, 2026
@Paururo
Paururo merged commit 847305d into main Aug 30, 2026
13 checks passed
@Paururo
Paururo deleted the feat/tree-traits-on-canvas branch August 30, 2026 16:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

documentation Improvements or additions to documentation phylogenetics Trees, tanglegrams, clades and branch layers rendering The SVG writer, themes, layout and the visual system tests The test suites and the property net

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant