Skip to content

Vis Node: show the whole y-axis label, and say what the bars count - #463

Merged
ianarawjo merged 3 commits into
mainfrom
claude/vis-node-y-labels
Sep 20, 2026
Merged

ianarawjo merged 3 commits into
mainfrom
claude/vis-node-y-labels

Conversation

@ianarawjo

Copy link
Copy Markdown
Owner

Two small problems in the same chart: plotting categorical scores (e.g. the categories of an LLM Scorer) as a horizontal bar chart.

Cut-off y-axis labels

That chart puts the score values on the y axis, but the left margin was sized from the series names (often just one model name, e.g. "Jev"), so the labels were clipped: "...ion model", "...stic oracle". The score values also skipped genUniqueShortnames, the helper the other charts use, so a long value could never wrap onto a second line.

The labels that actually land on the y axis are now collected as each branch sets them, and the margin is sized to fit those; score values go through the same shortening (and line breaking) as everywhere else.

"Number of 'true' values"

The x-axis title was hardcoded from the boolean case, but this chart counts how many scores fall in each category. It now reads "Number of scores", or "Number of scores ()" when the scores are keyed by metric, e.g. per judge.

Before / after, on a scorer with 14 categories and one judge: the y axis read "...ion model" over "Number of 'true' values"; it now reads "Decision model" over "Number of scores (Jev)".

Testing

  • jest: 1,234 passing; tsc, eslint and prettier clean.
  • In the app: a categorical LLM Scorer plotted by model, where every label now shows in full and the axis title names the metric.
  • Not verified: the boolean and numeric variants of this chart were eyeballed in code only; their y labels come from the same collected set, and the grouped boolean chart (which does count 'true' values) keeps its title.

🤖 Generated with Claude Code

ianarawjo and others added 3 commits September 20, 2026 11:09
Plotting categorical scores (e.g. an LLM Scorer's categories) puts the score
values on the y axis, but the left margin was worked out from the series
names instead -- often a single model name -- so the labels were cut off
("...ion model"). The score values also skipped the shortening helper that
adds line breaks, so a long one could never wrap.

The y-axis labels are now collected as they're set, whichever branch runs,
and the margin is sized to fit those; score values go through the same
shortening as everywhere else.

The x axis of that chart also read "Number of 'true' values", left over from
the boolean case. It counts the scores in each category, so it now says
"Number of scores", with the metric's name when one is selected.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
The categorical bar chart replaced layout.yaxis wholesale, dropping the axis
colour the base layout sets for the current theme. Its tick labels fell back
to Plotly's gray, which is hard to read on a dark background. It now keeps
what the base layout set.

Long labels also broke every 32 characters regardless of where that fell,
hyphenating mid-word ("program s-tate"). They now break between words, and
only a word too long for a line is split with a hyphen.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Two reasons dragging the resize handle left the plot at its old size:

- The ResizeObserver was created in a ref callback, but disconnected by a
  separate effect's cleanup. In development, StrictMode mounts effects twice
  (mount, clean up, mount), so the cleanup disconnected the observer and
  React never called the ref callback again to make a new one. It's now
  created and disconnected by the same effect, keyed on the div.
- Plotly.Plots.resize measures the plot's own div, which has no size of its
  own here -- it just matches the plot -- so resizing was a no-op. The plot
  is now told the size of the div the handle drags, and is also fitted when
  its data changes, since it's first drawn while that div is empty.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
@ianarawjo
ianarawjo merged commit 0f4e626 into main Sep 20, 2026
19 checks passed
@ianarawjo
ianarawjo deleted the claude/vis-node-y-labels branch September 20, 2026 15:24
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