Repository navigation
Add into= to lt_errorbar()/lt_dotplot() for a dedicated plot column - #42
Merged
Merged
Conversation
Contributor
|
🚀 Site preview: https://lt-pr-42.surge.sh Updates on every push; removed when this PR closes. |
yihui
force-pushed
the
errorbar-dotplot-into
branch
from
October 9, 2026 22:59
83f0595 to
e328b2d
Compare
The plot used to be drawn into the first value column's cells, clobbering its text, which forced callers who wanted both the values and a plot to manufacture a throwaway anchor column (forestly does this today). `into=` names a dedicated target column to draw into instead. The series columns are still read by reference for their values and stay visible (unless `hide` drops them), so a table can show every value column as text *and* a plot in its own column. Column creation is a generic, plot-agnostic core op: R emits an `add_col` op carrying only the column name (and an optional scalar fill), never a long empty array, so the JSON payload stays small for big tables. The runtime materializes the column client-side and the rest of the pipeline then treats it as an ordinary data column -- counted in colspans, labelled, drawn into by a plot cell, etc. The op is internal (no exported lt_add()); the plot functions call it when `into` names a missing column. Because `into` becomes a genuine visible column, nCol-derived structure (full-width footer/axis rows, separator group headers, spanners) adjusts automatically -- verified colspan tracks the extra column, and the interactive path renders it without touching real data. The error-bar and dot-plot cell renderers, which differ only in the per-cell SVG, now share one `axisPlot()` factory for their common resolve/cellClass/cell/foot (ticks, gridlines, footer axis, legend). Closes #40. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
yihui
force-pushed
the
errorbar-dotplot-into
branch
from
October 9, 2026 23:08
e328b2d to
d31e636
Compare
Ships the updated lt.js/lt-plot.js assets (generic add_col op + the shared axisPlot renderer) to the CDN for this branch. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
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.
Implements #40.
Summary
lt_errorbar()andlt_dotplot()used to draw the plot into the first value column's cells, clobbering its text.into=names a dedicated target column to draw into instead; the series columns are still read by reference for their values and stay visible (unlesshidedrops them), so a table can show every value column as text and a plot in its own column. Whenintois omitted, behavior is unchanged.How the extra column is added
Column creation is a generic, plot-agnostic core op. R emits an
add_colop carrying only the column name (and an optional scalar fill), never a long empty array, so the JSON payload stays small for big tables. The runtime materializes the column client-side, and the rest of the pipeline treats it as an ordinary data column — counted in colspans, labelled, drawn into by a plot cell, etc. The op is internal (no exportedlt_add()); the plot functions call it only whenintonames a missing column.Because
intobecomes a genuine visible column, nCol-derived structure (full-width footer/axis rows, separator group headers, spanners) adjusts automatically.Refactor
The error-bar and dot-plot cell renderers, which differ only in the per-cell SVG, now share one
axisPlot()factory for their common resolve/cellClass/cell/foot (ticks, gridlines, footer axis, legend).Verification
intorender headers, SVGs, and value cells.🤖 Generated with Claude Code