Skip to content

v0.3.0

Choose a tag to compare

@randyzwitch randyzwitch released this 23 Aug 16:09
· 478 commits to main since this release
9f8c920

Annotations, dual axes, SVG accessibility — plus a large performance pass and a real SVG legend bug fixed.

Highlights

Annotations and axis features. Plot.annotate_line() / annotate_area() / annotate_vline() / annotate_point() — reference lines, shaded bands, x-axis markers and point callouts — wired through render_facets() and render_layers() as well as standalone renders. Plus Plot.secondary_axis() with its own caption, Plot.labels() subtitles, and accessible_svg_string()/write_accessible_svg(). Theme.font_family now threads through every text request on both backends, titles are bold by default, Mark.POLAR takes multiple named series, and Violin/Ridgeline take a KDE bandwidth override and ggplot2's scale=area mode.

Correctness. Continuous color legends no longer render as a single flat color in SVG — stops were emitted in descending offset order, which the format clamps into one flat band. The raster output was correct throughout, so only the .svg was ever wrong, which is why an earlier pass at the same legend missed it. Legends also gained a third gradient stop for legibility. encode_hierarchy() now raises on a cycle rather than silently dropping the unreachable rows and their values.

Performance. 640×420, min of N, measured against v0.2.0 on its own canvas_mojo v0.4.1 baseline:

v0.2.0 v0.3.0
scatter n=50 11.09 ms 6.47 ms
sankey nodes=200 231.63 ms 124.14 ms
line n=5000 1678.05 ms 177.50 ms 9.5×

Half came from this package: one shared FontCache per render instead of one per label, hashed edge-list node resolution replacing a per-endpoint scan, and sub-pixel decimation for dense line and area charts. The other half came from profiling findings reported upstream and fixed in canvas_mojo v0.6.0/v0.6.1 — FontCache caching the parsed TTFFace rather than only the resolved path, polyline AA bucketing candidate segments by column, and SVG gradient stops sorted before emission. canvas_mojo pin moves v0.4.1 → v0.6.1.

Note

If you test SVG output against v0.2.0 fixtures: gradient <stop> elements are now emitted in ascending offset order. An assertion that pinned the old descending order will fail on upgrade — the new order is the correct one, and the old markup was invalid SVG. Update the expectation rather than pinning back.

411 assertions across 62 files, green on linux-64 and osx-arm64.

What's Changed

  • Generalize Mark.POLAR to support multiple named series by @randyzwitch in #67
  • Add optional KDE bandwidth override and ggplot2 scale=area mode to Violin/Ridgeline by @randyzwitch in #68
  • Route Mark.SANKEY's skip-column edges through invisible pass-through nodes by @randyzwitch in #69
  • Bump canvas_mojo to v0.5.0 (adds font-family to SVG text output) by @randyzwitch in #70
  • Thread Theme.font_family through every _TextRequest (raster + SVG) by @randyzwitch in #71
  • Bold chart titles by default (Theme.title_bold) by @randyzwitch in #72
  • Add Plot.labels() subtitle support by @randyzwitch in #74
  • Add Plot.annotate_line(): horizontal reference-line annotations by @randyzwitch in #75
  • Add Plot.secondary_axis(): dual y-axis support for render_layers() by @randyzwitch in #76
  • Add Plot.annotate_area(): shaded reference-band annotations by @randyzwitch in #77
  • Add accessible_svg_string()/write_accessible_svg(): real SVG accessibility markup by @randyzwitch in #78
  • Add Plot.annotate_vline()/Plot.annotate_point(): x-axis and point annotations by @randyzwitch in #79
  • Wire Plot.annotate_line()/annotate_area() into render_facets()/render_layers() by @randyzwitch in #80
  • Add secondary y-axis caption to render_layers() by @randyzwitch in #81
  • Fix muddy continuous color legends: add a third gradient stop by @randyzwitch in #82
  • Collapse 25 duplicated text-replay loops into three helpers by @randyzwitch in #83
  • Resolve each chart's font once, not once per label by @randyzwitch in #84
  • Raise on hierarchy cycles instead of silently dropping rows by @randyzwitch in #85
  • Resolve edge-list nodes in one hashed pass, not a scan per endpoint by @randyzwitch in #86
  • Thin sub-pixel detail out of dense line and area charts by @randyzwitch in #87
  • Fix continuous color legend rendering as one flat color in SVG by @randyzwitch in #91
  • Bump canvas_mojo to v0.6.1 by @randyzwitch in #93
  • Share one FontCache across each render's measurements by @randyzwitch in #94
  • Bump dataviz_mojo to v0.3.0 by @randyzwitch in #95

Full Changelog: v0.2.0...v0.3.0