Owner: Vega. Not curated for contributors: #21367 names Vega for this band's engine defects, and the Charts renewal waits on this fix before the Sun 22 Nov lock.
Context
On 18 Nov the slate read of the Charts group found the amCharts pie in examples/charts drawing no text: nine legend squares without names and no slice labels, while its tooltip carried the data (Lithuania: 30.5% (501.9)), at 1440 × 900 and 390 × 844 (defect-note a2375219). #21367 files each engine defect as a leaf before its card's renewal. This is the first leaf of Charts part 2.
The Problem
Measured on dev d4c33ec3bc in Chrome, examples/charts/index.html:
- The chart's SVG holds 28
<text> nodes with their strings (Lithuania: 30.5%, Czech Republic: 18.3%, …). Each is 16 px, visible, opacity 1, and has a real box (getBBox 121 × 18).
- Their computed fill is
rgb(255, 255, 255), inherited from a <g fill="#ffffff"> that amCharts writes.
- The body is
neo-theme-light on rgb(250, 250, 250). Every label is white on near-white. The tooltip draws its own background, so it stays readable.
The cause is in the main-thread addon: Neo.main.addon.AmCharts#create calls am4core.useTheme(am4themes_dark) before every chart (src/main/addon/AmCharts.mjs:149), whatever theme the page or the component uses. Once registered, the dark theme stays in amCharts' global list (am4core.registry.themes), so every later chart in that window is created dark.
The consumers and their themes:
examples/charts: no themes in its neo-config.json, so the light theme comes first.
apps/covid, apps/sharedcovid: ["neo-theme-dark", "neo-theme-light"].
apps/colors: ["neo-theme-dark"].
The Architectural Reality
Design authority: "Maps a Neo theme onto one of {@link #editorThemes}." (Neo.component.wrapper.MonacoEditor#themeMap, src/component/wrapper/MonacoEditor.mjs:121). Neo.component.wrapper.Mermaid#themeMap and #resolveTheme have the same shape: a wrapper around a third-party renderer resolves its library's theme from the Neo theme through a themeMap config.
Neo.component.wrapper.AmChart (App worker) creates its chart through the addon in afterSetMounted. It passes {config, package, type, combineSeriesTooltip, data} and no theme.
Neo.component.Base#getTheme() (src/component/Base.mjs:1652) resolves the component's theme, else a neo-theme-* class up the parent chain, else the window's themes[0].
- amCharts 4 applies themes when it creates an object, and
am4core.unuseAllThemes() clears the global list. A chart therefore has to be created in its theme, and a theme change on a mounted chart means creating it again.
The Fix
Neo.component.wrapper.AmChart:
- a
themeMap config: neo-theme-cyberpunk, neo-theme-dark and neo-theme-neo-dark → 'dark'; neo-theme-light and neo-theme-neo-light → null (amCharts' own light default);
- a
resolveTheme() reading themeMap[getTheme()];
create receives the resolved theme;
afterSetTheme creates a mounted chart again when the resolved theme changes.
Neo.main.addon.AmCharts#create: clear the global theme list, apply only the requested theme ('dark' → am4themes_dark), then create.
Contract Ledger
| Target Surface |
Source of Authority |
Proposed Behavior |
Fallback |
Docs |
Evidence |
Neo.component.wrapper.AmChart#themeMap (new config) |
MonacoEditor#themeMap, Mermaid#themeMap |
maps a neo-theme-* name to an amCharts theme name, or null |
an unmapped theme resolves to null, amCharts' light default; a consumer extends the map |
the config's JSDoc |
AC-2 |
Neo.main.addon.AmCharts#create(data), new optional data.theme |
this ticket |
'dark' creates this chart with am4themes_dark, and no theme carries over to the next chart |
absent or null → amCharts' default |
the method's JSDoc |
AC-3 |
Decision Record impact: none.
Acceptance Criteria
Out of Scope
- An amCharts v5 port (Discussion #20309).
- The COVID apps' theme button. It swaps the
neo-theme-* class in its MainContainer's cls and never sets theme, so a mounted chart keeps the theme it was created in. That is today's behaviour, unchanged here; it gets a defect-note.
- The Charts card itself (record, cover, layout): the next leaf of #21367.
Avoided Traps
- A substring test on the theme name:
neo-theme-cyberpunk is dark and its name does not say so (the reason MonacoEditor#themeMap is a map).
- Recolouring text through CSS (
svg text {fill: …}): amCharts writes fills as attributes on its groups, so a stylesheet would fight every chart's own colours, labels inside slices included.
- Keeping
useTheme without clearing the list: once one dark chart exists in a window, every chart created after it is dark too.
Related
Parent: #21367 · slate rows: #21142 · Charts part 1: #21322, PR #21328 · Discussion #20309 · defect-note a2375219.
Live latest-open + closed sweep: at 2026-11-18T20:43Z, read the latest 20 open, plus open and closed searches for "amCharts", "am4core", "chart text", "chart theme", "am4themes", "amCharts dark". The closed hits were unrelated, and nothing equivalent or excluded turned up. 81 open, red band; the owning epic is #21367, and this files under it. A2A in-flight sweep: the latest 30 messages in all read-states, newest 20:37:25Z, held no claim on amCharts or chart themes. MC sweep: "amCharts pie legend names and slice labels missing, white chart text on a light theme, tooltip shows the data", 6 results, no prior decision. Own-assignment sweep: 7 open, none overlapping (#21367 is the parent). Structure map: N/A, no Agent OS placement.
Origin Session ID: 82130fd4-f8a9-4794-9664-67fa9a133117
Retrieval Hint: "amCharts addon forces am4themes_dark: chart text white on light Neo themes; AmChart wrapper lacks the Monaco/Mermaid themeMap"
Owner: Vega. Not curated for contributors: #21367 names Vega for this band's engine defects, and the Charts renewal waits on this fix before the Sun 22 Nov lock.
Context
On 18 Nov the slate read of the Charts group found the amCharts pie in
examples/chartsdrawing no text: nine legend squares without names and no slice labels, while its tooltip carried the data (Lithuania: 30.5% (501.9)), at 1440 × 900 and 390 × 844 (defect-notea2375219). #21367 files each engine defect as a leaf before its card's renewal. This is the first leaf of Charts part 2.The Problem
Measured on
devd4c33ec3bcin Chrome,examples/charts/index.html:<text>nodes with their strings (Lithuania: 30.5%,Czech Republic: 18.3%, …). Each is 16 px, visible, opacity 1, and has a real box (getBBox121 × 18).rgb(255, 255, 255), inherited from a<g fill="#ffffff">that amCharts writes.neo-theme-lightonrgb(250, 250, 250). Every label is white on near-white. The tooltip draws its own background, so it stays readable.The cause is in the main-thread addon:
Neo.main.addon.AmCharts#createcallsam4core.useTheme(am4themes_dark)before every chart (src/main/addon/AmCharts.mjs:149), whatever theme the page or the component uses. Once registered, the dark theme stays in amCharts' global list (am4core.registry.themes), so every later chart in that window is created dark.The consumers and their themes:
examples/charts: nothemesin itsneo-config.json, so the light theme comes first.apps/covid,apps/sharedcovid:["neo-theme-dark", "neo-theme-light"].apps/colors:["neo-theme-dark"].The Architectural Reality
Design authority: "Maps a Neo theme onto one of {@link #editorThemes}." (
Neo.component.wrapper.MonacoEditor#themeMap,src/component/wrapper/MonacoEditor.mjs:121).Neo.component.wrapper.Mermaid#themeMapand#resolveThemehave the same shape: a wrapper around a third-party renderer resolves its library's theme from the Neo theme through athemeMapconfig.Neo.component.wrapper.AmChart(App worker) creates its chart through the addon inafterSetMounted. It passes{config, package, type, combineSeriesTooltip, data}and no theme.Neo.component.Base#getTheme()(src/component/Base.mjs:1652) resolves the component'stheme, else aneo-theme-*class up the parent chain, else the window'sthemes[0].am4core.unuseAllThemes()clears the global list. A chart therefore has to be created in its theme, and a theme change on a mounted chart means creating it again.The Fix
Neo.component.wrapper.AmChart:themeMapconfig:neo-theme-cyberpunk,neo-theme-darkandneo-theme-neo-dark→'dark';neo-theme-lightandneo-theme-neo-light→null(amCharts' own light default);resolveTheme()readingthemeMap[getTheme()];createreceives the resolvedtheme;afterSetThemecreates a mounted chart again when the resolved theme changes.Neo.main.addon.AmCharts#create: clear the global theme list, apply only the requested theme ('dark'→am4themes_dark), then create.Contract Ledger
Neo.component.wrapper.AmChart#themeMap(new config)MonacoEditor#themeMap,Mermaid#themeMapneo-theme-*name to an amCharts theme name, ornullnull, amCharts' light default; a consumer extends the mapNeo.main.addon.AmCharts#create(data), new optionaldata.theme'dark'creates this chart witham4themes_dark, and no theme carries over to the next chartnull→ amCharts' defaultDecision Record impact: none.
Acceptance Criteria
examples/chartsdraws its legend names and slice labels readable: a dark fill underneo-theme-lightand a light fill underneo-theme-dark, each with contrast ≥ 4.5:1 against the page background. Red ondevunder the light theme.neo-theme-*class.am4corestub): each is created in its own theme, and the light one inherits nothing from the dark one.themeon a mounted chart creates it again in the new theme (unit arm on the wrapper with the addon stubbed).Out of Scope
neo-theme-*class in its MainContainer'sclsand never setstheme, so a mounted chart keeps the theme it was created in. That is today's behaviour, unchanged here; it gets a defect-note.Avoided Traps
neo-theme-cyberpunkis dark and its name does not say so (the reasonMonacoEditor#themeMapis a map).svg text {fill: …}): amCharts writes fills as attributes on its groups, so a stylesheet would fight every chart's own colours, labels inside slices included.useThemewithout clearing the list: once one dark chart exists in a window, every chart created after it is dark too.Related
Parent: #21367 · slate rows: #21142 · Charts part 1: #21322, PR #21328 · Discussion #20309 · defect-note
a2375219.Live latest-open + closed sweep: at 2026-11-18T20:43Z, read the latest 20 open, plus open and closed searches for "amCharts", "am4core", "chart text", "chart theme", "am4themes", "amCharts dark". The closed hits were unrelated, and nothing equivalent or excluded turned up. 81 open, red band; the owning epic is #21367, and this files under it. A2A in-flight sweep: the latest 30 messages in all read-states, newest 20:37:25Z, held no claim on amCharts or chart themes. MC sweep: "amCharts pie legend names and slice labels missing, white chart text on a light theme, tooltip shows the data", 6 results, no prior decision. Own-assignment sweep: 7 open, none overlapping (#21367 is the parent). Structure map: N/A, no Agent OS placement.
Origin Session ID: 82130fd4-f8a9-4794-9664-67fa9a133117 Retrieval Hint: "amCharts addon forces am4themes_dark: chart text white on light Neo themes; AmChart wrapper lacks the Monaco/Mermaid themeMap"