Skip to content

Dev - #97

Open
Chenglong Wang (Chenglong-MS) wants to merge 5 commits into
mainfrom
dev
Open

Dev#97
Chenglong Wang (Chenglong-MS) wants to merge 5 commits into
mainfrom
dev

Conversation

@Chenglong-MS

Copy link
Copy Markdown
Contributor

This pull request introduces a stricter and more explicit policy for displaying units in Flint charts, requiring that visible units must be explicitly declared in the field's semantic annotation (unit). It also adds a new Image-Charts backend and updates related documentation and code to reflect these changes. The changes clarify how and when units are displayed, improve the handling of value labels and chart layout metadata, and enhance extensibility with a new backend.

Unit Display Policy and Handling

  • Only explicit annotation.unit now authorizes visible unit text; semantic types, field names, or data scanning are no longer sufficient. Compact units (like or%) may appear beside values, while lexical units (like years`) are stated once with the field title. [1] [2] [3] [4] [5]
  • Introduced resolveDisplayUnit and titleWithDisplayUnit in field-semantics.ts to standardize how display units are resolved and attached to field titles, ensuring only valid, explicit units are shown.
  • Updated theme grounding logic to use the new unit resolution, and removed fallback heuristics based on field names or data values. [1] [2] [3] [4]

Chart Layout and Label Improvements

  • Series-end labels now use a bounded packing pass for readability, and bar tables no longer repeat value columns as annotations.
  • Chart layout metadata now includes plotHeight, and the interface for label placement has been simplified by removing outsideMaxValue. [1] [2] [3]

Extensibility: New Image-Charts Backend

  • Added a new community backend for Image-Charts, allowing Flint input to be compiled into an image URL for use in environments without JavaScript. This includes documentation and package entry points. [1] [2]

Documentation Updates

  • Updated documentation across several files to clarify the new unit display policy, backend integration, and parameter tables. [1] [2] [3] [4] [5]

Minor Template and API Adjustments

  • Added suppressValueLabels to the chart template definition to prevent redundant value labels when values are already displayed in a dedicated column.

These changes make unit display more predictable and controlled, improve chart readability, and expand Flint's rendering options.

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.
feat: add Image-Charts backend (hosted-image-URL render target)
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.

2 participants