feat: add Image-Charts backend (hosted-image-URL render target) - #95
Open
Francois-Guillaume Ribreau (FGRibreau) wants to merge 2 commits into
Open
feat: add Image-Charts backend (hosted-image-URL render target)#95Francois-Guillaume Ribreau (FGRibreau) wants to merge 2 commits into
Francois-Guillaume Ribreau (FGRibreau) wants to merge 2 commits into
Conversation
Add an `image-charts` backend that compiles the shared core semantic layer into a single Image-Charts URL. Unlike the JS-spec backends it emits a permanent hosted-image URL that renders server-side and embeds anywhere an <img> works (email, PDF, Slack, no-code) with no runtime JavaScript. The assembler is pure: it builds a string with no network I/O, no crypto, and no dependencies, and emits unsigned free-tier URLs only. It reuses the Phase 0 semantic resolution and banded-axis overflow filtering, then serializes into the Image-Charts query grammar (cht, chd=a:, chs, chxt/chxl, chco, chdl, chm, chtt). Coverage is partial by design, like the Excel backend: bar/line/area/pie/doughnut/radar/ scatter map to a faithful cht; unsupported types throw. Wire the backend into the src barrel, tsup entries, package exports, the public-API smoke test, and the test-data generators.
Contributor
|
This is great! Let's add this to the repo. I think we can first merge it to dev, then I'll propose a backend extension folder to host your backend. |
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.
What
Adds an
image-chartsbackend toflint-jsthat compiles the shared core semantic layer into a single Image-Charts chart URL. That URL is a hosted image that renders server-side and embeds anywhere an<img>works (email, PDF, Slack, Notion, no-code) with no runtime JavaScript. It followsdocs/adding-a-backend.mdand mirrors the Excel backend, with an inline assembler that returns a declarative artifact ({ type: 'image-charts', url }) instead of a client-side JS spec, and gates chart types to the ones with a faithful mapping.Why
The existing backends emit a JS spec that a local renderer draws. That leaves out the case where a chart needs to live as a durable, shareable URL (an email, a PDF, a Slack or Notion embed, a no-code image control), where there is no JS runtime and the image has to persist. This backend covers that case by targeting a hosted renderer.
Design / scope
assembleImageChartsbuilds a string, with no network I/O, no crypto, and no new dependencies. The data reaches Image-Charts only if something later loads the<img>, which is the caller's choice, the same way choosing the Excel backend chooses Office.js. The library keeps its no-I/O property.cht,chd=a:,chs,chxt/chxl,chco,chdl,chm,chtt).cht. Unsupported types (Boxplot, Sankey, Heatmap, and so on) throw with a clear message.Tests
npm run typecheck,npm run lint,npm run buildare clean.npm run test: 947 passed, including 2 new public-API smoke assertions (URL shape, and a throw on unsupported types).Image-Charts: Core Templates) exercises the distinct URL param paths.Disclosure
I maintain Image-Charts, a commercial hosted chart-rendering service. Its free tier (unsigned URLs, watermarked) is what this backend emits. If you would rather not carry a third-party render target in-tree, I am happy to maintain this as an external companion package instead.