Skip to content

feat(v0.11.0): export charts as PNG (logging + histogram) - #131

Merged
ohgeeceee merged 1 commit into
mainfrom
feat/v0.11.0-chart-png-export
Jul 19, 2026
Merged

feat(v0.11.0): export charts as PNG (logging + histogram)#131
ohgeeceee merged 1 commit into
mainfrom
feat/v0.11.0-chart-png-export

Conversation

@ohgeeceee

Copy link
Copy Markdown
Owner

Summary

ROADMAP "Ready to Claim" item — export charts as PNG. Tier A frontend, no protected path, no new dependency.

  • New Export PNG button on the logging chart header (next to Export CSV) and in the histogram modal.
  • Both use Chart.js toBase64Image() → a browser-native anchor download (data: URL). No Rust round-trip, no Tauri command, no new dep.
  • Buttons enable only once a chart exists: the logging PNG button mirrors the btn-log-export enable points; the histogram PNG enables inside renderHistogram and disables on modal close.
  • Shared downloadDataUrl(filename, dataUrl) helper.

Verification

  • npm run build (canonical tauri build) — passes, bundles build clean.
  • node --check src/js/main.js — OK.
  • node --test src/js/test/*.test.cjs — 56 passing.

Tier

A (frontend-only). 3 files: src/js/main.js, src/index.html, CHANGELOG.md.

Files

src/js/main.js        | Export PNG handlers (logging + histogram) + downloadDataUrl() helper; enable/disable wiring
src/index.html        | btn-log-export-png (logging head); histogram-export (modal actions)
CHANGELOG.md          | 0.11.0 section

@ecc-tools

ecc-tools Bot commented Jul 19, 2026

Copy link
Copy Markdown
Contributor

ECC bundle files are already tracked in this repository. Skipping generation of another bundle PR.

ROADMAP Ready-to-Claim item, Tier A frontend.

- New Export PNG button on the logging chart header and in the histogram modal.
- Both use Chart.js toBase64Image() -> a browser-native anchor download (data: URL); no Rust round-trip, no new dependency.
- Buttons enable only once a chart exists (logging PNG mirrors btn-log-export enable points; histogram PNG enables in renderHistogram, disables on modal close).
- Shared downloadDataUrl(filename, dataUrl) helper.

Verification: npm run build passes (bundles build clean); node --check main.js OK; node --test 56 pass. No protected-path change.
@ohgeeceee
ohgeeceee force-pushed the feat/v0.11.0-chart-png-export branch from d0a65d5 to 0459cf7 Compare July 19, 2026 16:45
@ohgeeceee
ohgeeceee merged commit d2d1d07 into main Jul 19, 2026
10 of 11 checks passed
@ohgeeceee
ohgeeceee deleted the feat/v0.11.0-chart-png-export branch July 19, 2026 16:48
ohgeeceee added a commit that referenced this pull request Jul 21, 2026
Mirrors the v0.11.0 PNG-export slice (#131) but as a vector format
that survives a 4K forum upload and re-sizes cleanly for embedded
post screenshots.

- New src/js/svg_export.js: pure-data serializer (no DOM, no Chart.js)
  with chartToSvg(chart) and histogramToSvg({labels, counts, axisLabel}).
  Hand-rolled rather than pulling chartjs-plugin-svg-export / canvas2svg
  as a runtime dependency — for a forum-paste vector the goal is
  faithful vector, not pixel-perfect canvas mirror.
- New src/js/svg_export.test.js: 10 tests covering null/empty inputs,
  single + multi-series rendering, NaN/Infinity point skipping, label
  thinning for dense histograms, XML special-char escaping, and the
  requested opts (width/height/viewBox).
- src/index.html: new "Export SVG" button next to each existing PNG
  button (logging chart header + histogram modal actions), plus a
  <script> tag for svg_export.js before main.js.
- src/main.js: button enable/disable mirrors PNG (startLogging +
  restoreSession + renderHistogram enable; histogram-close disable);
  click handlers reuse the existing downloadDataUrl helper with a
  URL-encoded data: URL (human-readable file content, ~33% smaller
  than base64).

Verification: npm run build passes (MSI + NSIS bundles clean),
node --check on the two new JS files, node --test 79 pass (was 56).
No protected-path change. No new dependency.

Co-authored-by: Jon currie1 <ohgeeceee@users.noreply.github.com>
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