LearnNewsExamplesConnect
Frontmatter
assigneesneo-opus-vega
createdAtNov 18, 2026, 11:04 PM
updatedAtNov 19, 2026, 2:30 PM
githubUrlhttps://github.com/neomjs/neo/issues/21406
authorneo-opus-vega
commentsCount0
parentIssue21367
subIssues[]
subIssuesCompleted0
subIssuesTotal0
contentTrust
projected
quarantined0
signals[]
blockedBy[]
blocking[]
closedAtNov 19, 2026, 2:30 PM

Charts, Canvas & Maps shows sparklines, Mermaid and the graph scene

Closed v14.0.0/archive-v14-0-0-chunk-4 enhancementaicoreportal
neo-opus-vega
neo-opus-vega commented on Nov 18, 2026, 11:04 PM

Context

Charts part 2 of #21367. Part 1 (#21322, PR #21328) published OpenStreetMaps. The group's target is five cards; today it publishes one. graph-scene and am-charts are records without an image, so they stay hidden. Neo.component.Sparkline and Neo.component.wrapper.Mermaid have no example at all (#21367, "Some components have no example at all").

The Problem

  • A canvas has no DOM signal for "drawn". captureExamples.mjs waits until the region's geometry is stable and no Web Animation runs (captureExamples.mjs:249-254). Pixels drawn in the canvas worker are invisible to both checks, so a cover can be taken before the content exists. #21367's rule is that a card publishes only with a cover taken after its content is drawn. OpenStreetMaps solved this for its map with data-rendered (src/main/addon/OpenStreetMaps.mjs:145). Both renderers here draw in the canvas worker instead.
  • The graph scene's e2e shows what "drawn" takes. test/playwright/e2e/rendering/GraphScene.spec.mjs:58-63 polls "Read stats" until frames > 0 && !owed and the node count matches. Nothing on the page says so without a click.
  • A sparkline pulses at random. Neo.canvas.Sparkline#renderLoop spawns pulses every 200 ms to 1.2 s, so a cover with the pulse on differs between runs.

The Architectural Reality

Design authority: #21367's body, "Covers: a card publishes only with a cover taken after its content is drawn. A canvas scene needs a drawn signal on the DOM, as OpenStreetMaps got data-rendered in #21328."

  • Neo.component.Sparkline and Neo.app.SharedCanvas (the graph scene's host) both extend Neo.component.Canvas (src/component/Canvas.mjs, 202 lines), so the shared base is the one place for a drawn flag.
  • Neo.canvas.Sparkline#updateData draws synchronously on a first load or a snap, and so does #updateSize (src/canvas/Sparkline.mjs:341-410). Neo.component.Sparkline#afterSetOffscreenRegistered sends both but awaits neither (src/component/Sparkline.mjs:186-219).
  • Neo.canvas.GraphScene draws only when a frame is owed (requestFrame, renderLoop). setScene owes a frame and resolves before it draws (getStats JSDoc: "owed is a requested frame that has not drawn").
  • Neo.main.addon.Mermaid#render runs mermaid.run, which marks the element data-processed and puts an <svg> into it (src/main/addon/Mermaid.mjs:128-160). That is already a DOM signal.
  • Catalog: a record publishes once image is set (apps/portal/resources/data/examples.json), and its cover comes from a recipe in example-captures.json.

The Fix

  1. Neo.component.Canvas#drawn_ (Boolean, default false): the host's root carries data-drawn="true" while it is true.
  2. Neo.component.Sparkline awaits its first updateData and updateSize in afterSetOffscreenRegistered, then sets drawn. It clears drawn on unregister.
  3. Neo.canvas.GraphScene#whenDrawn (remote, app): resolves once no frame is owed and no flight runs, right away if that is already so. The graph scene example's SceneCanvas clears drawn before it sends a scene and sets it after whenDrawn.
  4. examples/component/sparkline/: KPI cards, each a figure and a sparkline that a simulated feed extends every second, with switches for pulse and transition. Usable at 390 px.
  5. examples/component/wrapper/mermaid/: diagram source beside the live diagram, presets for a flowchart, a sequence, a class and a Gantt diagram, following the page theme. Stacked at 390 px.
  6. Catalog: records sparklines and mermaid in family: 'charts', plus the image for graph-scene. The recipes wait on [data-drawn='true'] or .neo-mermaid[data-processed] svg; the sparkline recipe turns the pulse off first. Covers go through a neomjs/pages PR. The portal unit and e2e counts follow.

Contract Ledger

Target Surface Source of Authority Proposed Behavior Fallback Docs Evidence
Neo.component.Canvas#drawn_ (new) src/component/Canvas.mjs true once the subclass knows its pixels are drawn; reflected as data-drawn absent attribute = not drawn (no change for hosts that never set it) JSDoc unit arm
Neo.canvas.GraphScene#whenDrawn (new remote) src/canvas/GraphScene.mjs remote.app resolves after the owed frame draws with no flight resolves at once when nothing is owed JSDoc GraphScene.spec.mjs arm
catalog records sparklines, mermaid (new) examples.json published cards in Charts, Canvas & Maps none the records' feature / lookFor portal specs

Decision Record impact: none.

Acceptance Criteria

  • AC-1: Neo.component.Canvas#drawn_ reflects as data-drawn on the host root; unit arm.
  • AC-2: a Neo.component.Sparkline sets drawn only after its values are drawn at its measured size, and clears it on unregister; the unit arm is red on dev.
  • AC-3: Neo.canvas.GraphScene#whenDrawn resolves after an owed frame draws, not before; unit arm in test/playwright/unit/canvas/GraphScene.spec.mjs.
  • AC-4: the sparkline example shows its cards with drawn lines, the switches change the drawing, and nothing is cut at 390 × 844.
  • AC-5: the Mermaid example draws each preset, an edit redraws it, a theme change redraws it in the other theme, and nothing is cut at 390 × 844.
  • AC-6: the graph scene example carries data-drawn after its first scene, loses it while a new scene is owed, and regains it.
  • AC-7: Charts, Canvas & Maps publishes graph-scene, sparklines and mermaid with covers taken after data-drawn or the Mermaid SVG; three capture runs show the same content; portal unit and e2e counts updated.

Out of Scope

  • amCharts v5 (Discussion #20309), CesiumJS and Google Maps (#21367).
  • A drawn signal for other canvas renderers; they get one when an example or test needs it.
  • The 100k clustered scene's cover: the card shows the default 240-node scene.
  • The am-charts cover: its labels draw only with PR #21401 (#21400), so it publishes after that merge, not here.

Avoided Traps

  • Calling the flag rendered: in component vocabulary that means the vnode reached the DOM. A canvas's pixels are drawn, so the flag is drawn, and data-rendered stays the OpenStreetMaps map's.
  • Polling stats from the example to stamp the attribute: that copies the e2e's loop into every page. The renderer knows when its owed frame drew.
  • A cover with the pulse on: random pulses change the frame from run to run.

Related

Parent #21367 · #21140 (dates: lock Sun 22 Nov 18:00 CET) · Part 1 #21322 / PR #21328 · #21400 / PR #21401 (amCharts text) · #21142 (slate rows).

Live latest-open + closed sweep: latest 20 open read, plus open and closed searches for "sparkline example", "mermaid example", "graph scene cover" and "GraphScene drawn" at 2026-11-18T22:05Z. Closed hits (#20286, #20486, #19290 and others) carry no exclusion for examples or a drawn signal. Open count 80 (red band), folded under #21367. A2A in-flight sweep: latest 30 messages in all read-states up to 21:58Z, no claim on this scope. Memory Core sweep ("sparkline example mermaid example graph scene cover drawn signal charts group", 5 results): no prior decision. Own assignments: 8 open, none overlapping. Structure map: N/A (examples, src/component, src/canvas, portal data; no Agent OS placement).

Origin Session ID: dc325fc3-6caf-42ab-a941-b0eef5f37019 Retrieval Hint: "Charts part 2: canvas drawn signal data-drawn, GraphScene whenDrawn, sparkline and mermaid examples, chart covers"