Release Notes
The release that makes the front ends downloadable: charton and
nu_plugin_charton now ship as prebuilt binaries for Linux x64, Windows x64 and
Apple Silicon, next to the library on crates.io.
Added
charton-cli can draw a chart in the terminal. charton plot and
charton render accept --inline (draw instead of writing the default
chart.svg), --inline-style halfblock|iterm2|kitty|sixel (implies
--inline), and --force-inline for a pipe or redirect; -o still writes a
file alongside the terminal chart. The protocol encoders now live in the
library as charton::terminal behind the terminal feature, so the CLI and
the Nushell plugin draw the same frame, and CHARTON_INLINE_STYLE selects the
protocol in both front-ends.
- View composition: several charts on one page.
Composition places
independent views on a grid of tracks — Composition::grid(rows, columns), or
the hconcat / vconcat shorthands — sized with with_column_width /
with_row_height and filled with with_cell(row, col, view) /
with_spanning_cell(..).
A track is either TrackSize::fixed(px) (exactly that many pixels) or
TrackSize::fill(weight) (a share of what is left), so a thin strip keeps its
size while the main view takes the rest. The gap between tracks is set with
with_spacing for both axes, or with_column_spacing / with_row_spacing for
one. A view can also ask for its own room
(with_width / with_height) and hide its axis furniture
(with_show_x_axis / with_show_y_axis).
Composition::marginal(main, Marginals::…) — the marginal recipe, as one
call. A grid whose strip tracks are TrackSize::fixed, whose cells align by
data rectangle (Align::Each), with the corners left empty — for any combination
of the four
edges (with_top / with_bottom / with_left / with_right, plus
with_strip_size). It decides the layout only: what each strip draws stays the
caller's decision, so a strip still hides its own shared axis and legend.
examples/concat_marginal_scatter.rs is now nine lines of layout instead of
fifteen, and Marginals::new() with no strips is a plain one-cell page.
- A nested composition aligns like a chart.
View is no longer an enum with a
"compositions cannot do this" arm in six places; it is one handle over a closed
two-impl trait — a finished chart or another page — so every cell is asked the
same questions: where does your data land, what legend could you hand over, what
scale did you resolve, draw yourself. A nested page answers from its master
cell (the largest), so Align::Each now crosses a nesting boundary: the
parent intersects and pins the inner page's master panel, the inner page re-solves
around it, and a scale resolved inside can be handed back out.
examples/concat_marginal_nested.rs is Vega-Lite's own shape for the marginal
figure — vconcat[bar, hconcat[rect, bar]] — which could not be aligned before.
hconcat / vconcat take a tuple as well as a list, so a row may mix charts
and pages: Composition::vconcat((strip, inner_page)) (the IntoViews trait).
Align lines views up by their data rectangle, not their canvas.
Align::None (the default) places every cell by its canvas; Align::Each gives
each track one common data rectangle and Align::All gives the whole page one.
The three values are Vega-Lite's bounds + align collapsed into the pairs they
always come in — "flush bounds with no alignment" is None, so there is no
fourth state that silently does nothing. The cells that share a rectangle share
the scale in it (with_resolve(Resolve::Shared), the default; Independent opts
out). That is what turns three ordinary charts into a scatter with marginal
histograms — no new mark, no new statistic.
docs/src/layout/composition.md documents the model, the track arithmetic and
the boundaries against faceting; examples/concat_marginal_scatter.rs and
examples/concat_marginal_histograms.rs draw the two reference figures (R's
ggExtra::ggMarginal, Vega-Lite's marginal histograms) on iris.
- Five runnable examples, one per usage, each included and explained in the
book chapter: the marginal recipe as one call (concat_marginal_scatter), the same
layout as a plain grid (concat_marginal_histograms), the same figure nested
(concat_marginal_nested), the general dashboard with a spanning header
(composition_dashboard), two panels sharing one axis
(composition_linked_panels), and Align::All giving four different charts one
panel size (composition_same_panels).
with_legend_position(edge) draws a cell's legend on a page edge. A legend
belongs to the view that declares it, so by default it is drawn inside that
view's band — between two data rectangles when the view sits in the middle.
Hoisting reserves a page band instead, lines the legend up with the panel it
explains, and lets the cell grow into the room the legend gave up.
with_legend_from(row, col) names the cell it comes from, instead of leaving the
choice to the "largest cell that has a legend" rule; a nested page can hand its
legend up the same way.
with_scale_factor(f) on a composition, so a page exports raster output at the
same pixel density as a single chart instead of always at 1×.
with_show_legend(bool) on a view, next to with_show_x_axis /
with_show_y_axis: the third "view chrome" switch, and the one a marginal strip
needs. Same setting as configure_theme(|t| t.with_show_legend(false)), spelled
as the switch it is.
- A page's legend position is the page theme's legend position. A page used to
carry its own copy, so configure_theme(|t| t.with_legend_position(Left)) was a
silent no-op while with_legend_position(Left) worked. They are now one field:
either spelling hoists the legend, and LegendPosition::None (the page default)
means every cell keeps its own.
- A single-layer chart can be a cell directly.
View is From<Chart<T>> as well
as From<LayeredChart>, so with_cell(0, 0, chart!(..)?.mark_point()?.encode(..)?)
needs no .into().
Role::View, the semantic scope around one composition cell.
Theme margins now also apply to a composition's page, so a page of charts and
a single chart share the same outer spacing.
- A JSON chart document — a Vega-Lite v5 subset (
spec feature). A chart can
now be written as data instead of Rust: data (inline values or a local path),
mark, encoding (x, y, y2, color, size, shape, text,
pathGroup), transform (filter, fold, aggregate, bin, window),
layer, facet, plus title / description / theme. Validation runs
entirely before lowering and reports stable codes with a JSON Pointer to the
original document, a message and a hint; the dialect is a subset, so an
unsupported field is an error, never a silent no-op. charton::spec::schema()
emits the JSON Schema, and tests/spec/{accept,reject} keep the boundary
(20 documents that must render, 59 that must be refused at an exact pointer).
The field-by-field lossless / lossy / rejected table is
docs/src/spec/lowering-map.md.
- Four pure data transforms and one binning implementation.
Filter, Fold,
Aggregate, Bin and WindowTransform are Dataset -> Dataset functions the
typed Chart API and the spec layer share. BinEdges is now the only place
that computes histogram edges, so hist, rect and the bin transform can no
longer drift apart.
charton-cli, a command line and an MCP server. The charton binary turns
a CSV/TSV/NDJSON/stdin table into a chart (plot), renders a document
(render), checks one without drawing (validate, with --json diagnostics
and exit code 4), and prints the dialect's JSON Schema (schema). plot is
sugar over render: its flags build the same Spec and take the same
validation + lowering path, so --emit-spec exports the chart, and
render(emit-spec(plot(...))) is byte-identical to plot(...). charton mcp
exposes get_schema, profile_data, list_marks, list_themes,
validate_spec, render_spec and export_spec over JSON-RPC, confined to
--data-dir (paths are canonicalised first), read-only unless --allow-write, with
size limits, no network and no expressions.
- Contract guards for the new surface.
tests/api_baseline.rs records the
public items in docs/api-baseline.txt; tests/spec_schema.rs fails when the
committed schema/charton-v0.schema.json drifts from the Rust types; the
negative corpus asserts that every diagnostic code is reachable and carries a
pointer.
Fixed
load_polars_df! works with Polars 0.54 and 0.55 again. Polars removed the
IntoIterator for &ChunkedArray implementations in 0.54, so the macro now uses
ChunkedArray::iter(). Categorical/Enum columns are also dispatched on their
physical width (U8/U16/U32) instead of assuming cat32(), which Polars 0.53+
no longer guarantees. The conversion now builds a proper dictionary, so
n_unique() and unique_values() no longer report one entry per row.
- The Polars macros no longer turn most
Time values into nulls. Polars
stores Time as nanoseconds since midnight, but the macros passed that total
into Time::from_hms_nano's sub-second slot, so every value at or after
00:00:01 failed to convert. The total is now split into hours/minutes/seconds
and nanoseconds. Duration scaling also saturates instead of overflowing.
load_polars_df! accepts UInt8, UInt16, and Float16 columns.
UInt8/UInt16 are widened losslessly to Charton's UInt32 vector and
Float16 to Float32 (the legacy macro also accepts UInt8/UInt16).
- A chart with no legend no longer reserves a legend strip. The layout built
the strip from theme.legend_margin whenever show_legend was on, even when
there was no guide to draw in it, leaving a dead band the width of that margin
on the edge the legend would have used (15px by default). Legend-less charts get
that space back — most visible on a 60px marginal strip, which uses 25% more of
its cell.
Changed
- The CLI and the Nushell plugin spell a channel the same way: as a column.
--size and --shape name a column in both front-ends, which is what
encoding.size.field and encoding.shape.field mean in a document; a fixed
value takes the --mark- prefix (--mark-size 8, --mark-shape square), the
family --mark-color and --mark-width already used. The plugin's
--size-by / --shape-by are gone: the channel flag is --size / --shape,
and a layer record says size: <column> instead of size_by. The old names
meant the opposite of the CLI's, so a habit carried across front-ends produced
a confusing "expected a number" error rather than a chart.
charton mcp --data-dir is now charton mcp --root. The directory is not
where the data lives and not where the images go: it is the one region of the
file system the server may touch, and every path a tool is handed resolves
against it. Naming it after the input hid the output half and collided with
validate --data, which really does mean a table.
- Five short flags mean the same thing in the CLI and the plugin.
-x, -y,
-c (--color), -o (--output) and -t (--title) are the five a person
types most; everything else is long-only in both, so -o is no longer the one
arbitrary short flag in charton and a letter can be learned once.
--mark accepts the hyphenated mark names as a hidden alias, so
density-2d works next to the document's density_2d. The canonical spelling
stays the document's, and the help lists only that.
- The raster export plan and the pixel-buffer pipeline moved into the raster
backend (RasterPlan, render_document), so a composition and a single chart
cannot disagree about supersampling or background fill.
- The CLI is a downloadable binary, not only a
cargo install. A GitHub
Release is now built by cargo-dist:
pushing a vX.Y.Z tag produces charton and nu_plugin_charton archives for
x86_64-unknown-linux-musl (static, so the download does not depend on the
host's glibc), x86_64-pc-windows-msvc and aarch64-apple-darwin, each with a
.sha256, plus one-line install.sh / install.ps1 installers. Tags are
vX.Y.Z with no crate prefix, because one tag now announces all three crates.
The version lives once in [workspace.package], and the charton requirement
in the CLI and the plugin is the 0.9 line instead of an exact patch, so a
library patch no longer invalidates a released front end. The pipeline is
dist-workspace.toml plus the generated
.github/workflows/release.yml.
- The release build is tuned for the download.
[profile.release] enables
thin LTO, a single codegen unit and symbol stripping; cargo-dist builds through
[profile.dist], which inherits it. The library crate is unchanged — only the
two shipped binaries get smaller and faster at the cost of a longer link.
Documentation
- The book leads with the entry points. Installation, the command line, MCP,
the JSON dialect and the Nushell plugin now come before the engine internals;
the installation page lists the real feature set (spec, png, pdf,
wgpu, geo, arrow, parallel), and the error, theme, performance and
production pages describe the current API instead of the pre-spec one. The CLI,
MCP and plugin guides share one description of the dialect and its exit codes.
charton-cli 0.9.2
Install charton-cli 0.9.2
Install prebuilt binaries via shell script
curl --proto '=https' --tlsv1.2 -LsSf https://github.com/wangjiawen2013/charton/releases/download/v0.9.2/charton-cli-installer.sh | sh
Install prebuilt binaries via powershell script
powershell -ExecutionPolicy Bypass -c "irm https://github.com/wangjiawen2013/charton/releases/download/v0.9.2/charton-cli-installer.ps1 | iex"
Download charton-cli 0.9.2
nu_plugin_charton 0.9.2
Install nu_plugin_charton 0.9.2
Install prebuilt binaries via shell script
curl --proto '=https' --tlsv1.2 -LsSf https://github.com/wangjiawen2013/charton/releases/download/v0.9.2/nu_plugin_charton-installer.sh | sh
Install prebuilt binaries via powershell script
powershell -ExecutionPolicy Bypass -c "irm https://github.com/wangjiawen2013/charton/releases/download/v0.9.2/nu_plugin_charton-installer.ps1 | iex"
Download nu_plugin_charton 0.9.2