Repository navigation
kuva v0.5.0
[0.5.0] — 2026-08-07
Added
- PDF backend migrated from
svg2pdftokrilla/krilla-svg, plus multi-page output —svg2pdfwas archived upstream by its own maintainer as unmaintained, recommendingkrilla/krilla-svg(same author, used by Typst) as the successor.PdfBackend::render_scenes(&[Scene])and the one-shotrender_to_pdf_multi(pages)render one kuva canvas per PDF page into a single document (like R'spdf()device, e.g. for fgbio/Picard-style reports); nothing is rasterized. By default each page takes its scene's natural size;PdfBackend::with_page_size(PageSize::inches(11.0, 8.5))instead coerces every page to a fixed size, scaling each scene proportionally to fit and centering it, with the scene's own background color filling the letterbox margin. Thepdffeature now requires Rust >= 1.92 (krilla's MSRV) — higher than kuva's own crate-levelrust-version(kept at 1.87 deliberately; see README.md's note on why), tracked separately as[package.metadata.msrv] pdf_featureinCargo.toml. CI'smsrvjob now buildscli,png,embed_font(notcli,full) againstrust-version, plus a newpdf-msrvjob that buildscli,fullagainstpdf_featurespecifically — the pre-existingmsrvjob would otherwise have silently asserted a false claim (thatfullbuilds at 1.87) forever, since nothing else exercises that combination at the older toolchain.PdfBackendis no longer a zero-sized unit struct usable as a bare value (PdfBackend.render_scene(...)) — usePdfBackend::new(). kuva twin-yCLI subcommand — dual-axis plot from the command line: two series sharing an x-axis but with independent primary (left) and secondary (right) y-scales, e.g. temperature vs. rainfall. Supportslineandscatteras the plot type on either axis (--primary-type/--secondary-type); per-side color and legend label flags; new shared--y2-label/--y2-min/--y2-max/--log-y2/--y2-tick-formatflags. Closes #106.Layout::with_y2_axis_min/with_y2_axis_max— unconditional secondary-Y-axis bound overrides, mirroringwith_y_axis_min/with_y_axis_max. Found needed while building thetwin-yCLI: the existingwith_y2_rangestill gets nice-rounded and capped near the secondary plots' own data (the same path the auto-computed range takes), so a requested bound far from the data was largely ignored.- CLI date/time X axis (
--x-date-format,--x-date-unit,--x-date-tick-format,--x-date-tick-step) onscatterandline— parses the X column as a date/time using astrftime-style format instead of a plain number, then ticks it with aDateTimeAxis(auto-selected unit/format by default, or an explicit unit with a sensible default tick format, overridable). Closes #107. Layout::with_label_background— a semi-opaque background rect behind in-fill value labels (Treemap, Sunburst, Mosaic, Funnel, Gantt), for readability over busy fills or BW-mode hatch patterns. Off by default in color mode; on automatically in BW mode; overridable either way. CLI:--label-background. Closes #102.Layout::with_subtitle— render a secondary line centred under the title for a one-line data summary (e.g.n = 1,234 cells). Sized atround(0.7 × title_size)by default or set explicitly withwith_subtitle_size; coloured by muting the title colour toward the background so it adapts to light and dark themes rather than a fixed grey; word-wrapped independently of the title viawith_subtitle_wrap. The title block reserves the extra height automatically so the plot is pushed down rather than overlapped. CLI:--subtitleand--subtitle-wrapon every subcommand. See Reference → Layout.ParetoPlot— bar chart of category values, sorted descending by default, with a superimposed cumulative-percentage line on a secondary axis (fixed 0-100%, the "80/20 rule" chart). Optional dashed threshold reference line (default 80%, labeled with its percentage) and per-point cumulative-percentage labels. Legend shown by default ("Value" / "Cumulative %"). Secondary-axis ticks are formatted as percentages (0%,20%, …). Categorical axis defaults to rotated (-45°), collision-thinned labels..with_max_categories(n)collapses a long tail of small categories into one stacked "Other" bar, decoded via per-segment legend entries, instead of cluttering the axis..with_horizontal(bool)puts categories on Y and values on X. CLI:kuva pareto.- Secondary X-axis (
Layout::with_x2_range/with_x2_label/with_log_x2/with_x2_tick_format,ComputedLayout::map_x2) — a top-drawn counterpart to the existing secondary Y-axis (right side), for plots whose secondary encoding pairs with the value axis rather than the category axis (used by horizontalParetoPlot). Third-party plot types can use it directly via the sameLayout/ComputedLayoutfields. - CLI
--headerflag — forces the first row to be treated as a header even when it looks like data, the explicit counterpart to the existing--no-header. The two are mutually exclusive. Useful for inputs whose column names are all-numeric (e.g. years). Ignored, with a warning, for parquet input (self-describing). Part of #111.
Fixed
- CLI header auto-detection missed a header masked by a leading numeric column (#111) — the detector only checked whether the first field of the first row was non-numeric, so an input like
5,dataover0,1/1,2treated the header row as data and failed withcannot parse 'data' as a number. Detection now also flags a header when any column holds a non-numeric label atop an otherwise all-numeric column. The rule is a strict superset of the old first-cell check, so existing detections are unchanged; genuinely ambiguous inputs are covered by the new--header/ existing--no-headeroverrides. examples/all_plots_simple.rs/all_plots_complex.rs(the "every plot type in one figure" gallery assets) were missingParetoPlot,BandPlot, andLegendPlot— Replaced some plot repeats to include missing plot types.man/kuva.1was missing thetwin-ysubcommand — regenerated (kuva man > man/kuva.1).Scatter3D/Surface3Dinstances combined in one panel now share one 3D coordinate box — each instance previously calleddata_ranges()/drew its own wireframe box independently, so twoScatter3D(or a mix withSurface3D) in the samerender_multiplecall each normalized to their own min/max and could project completely different data onto identical screen coordinates, with the box itself drawn twice.render_multiplenow computes one mergedDataRanges3Dand draws the box once, shared by every 3D instance in the call.- Twin-Y x-axis no longer clips a secondary series that extends further than the primary series —
Layout::auto_from_twin_y_plots'swith_y2_autounioned the padded x-range across primary and secondary, but leftdata_x_range(the raw extent used by the axis-range capping added for #98) pinned to primary's range alone. When the capped branch triggered, the x-axis max was computed from primary's raw max instead of the true combined max, rounding the axis short and clipping secondary's data past that point.data_x_rangeis now unioned across both series.
Security
- Data-derived text (group names, legend/category labels) is now XML-escaped before being written into SVG attribute values (e.g.
data-group="...",data-x="...") in interactive-mode output. Previously these were interpolated raw, so a crafted data file's label could break out of the attribute and inject arbitrary markup (a stored-XSS-style issue) into the rendered SVG. Fixed at everyextra_attrscall site insrc/render/render.rsvia a newrender_utils::escape_attr. - Arbitrary/unrecognized color strings (
Color::Css, e.g. an unrecognized--color-byvalue) are now XML-escaped when written intofill/strokeattributes, andstroke-dasharray, rootfont-family/fill, and the background-rectfillin the SVG backend are now escaped as well, closing the same class of attribute-breakout issue for CSS-derived values. --terminaloutput now filters control characters (ESC, C0/C1, DEL) out of data-derived labels before they reach the character grid, replacing them withU+FFFD. Previously a label containing a raw escape sequence (e.g. from an untrusted data file) could be replayed into the operator's real terminal when the rendered grid was printed, potentially triggering an ANSI/OSC-based terminal escape injection.
Reported via private disclosure (GHSA-3c48-9r95-hqhr). See the advisory for full details once published.
What's Changed
- Add Layout::with_subtitle for a muted second title line by @tfenne in #105
- Reject unsupported output extensions by @eneskemalergin in #115
- Reduce emit-code test disk cost with feature-split checks. by @eneskemalergin in #114
- v0.5.0 release by @Psy-Fer in #116
New Contributors
- @eneskemalergin made their first contribution in #115
Full Changelog: v0.4.0...v0.5.0