Skip to content

[PROTOTYPE] DRAFT apply configured data element/indicator color #3469

Draft
karolinelien wants to merge 1 commit into
masterfrom
feat/configured-item-color
Draft

[PROTOTYPE] DRAFT apply configured data element/indicator color #3469
karolinelien wants to merge 1 commit into
masterfrom
feat/configured-item-color

Conversation

@karolinelien
Copy link
Copy Markdown
Collaborator

@karolinelien karolinelien commented Jun 2, 2026

Draft prototype — not for merge.

Spike of letting a visualization use each data element's / indicator's configured style.color (set in Maintenance)
instead of the color-set palette, via a single toggle in Style → Color set: "Use configured item color when available."

Behaviour

Colour-source precedence: Legend > configured item color > color set.

  • Legend on → legend controls colours (unchanged). The toggle's help text reflects this.
  • Legend off + toggle on → each item with a configured style.color uses it; items without one fall back to the color set.
  • Toggle off → current behaviour (color set).

Try it (Netlify preview)

  1. Open the favorite ANC: Key Coverages (indicators ANC 1/2/3 Coverage — each has a colour configured on play).
  2. Style → Color set → tick "Use configured item color when available"Update.
  3. Bars repaint to the configured colours; untick + Update returns to the palette.

What's here

Area Change
Option New useItemColor option, savable, added to the column-chart option set
Fetch style[color] added to the item field set
UI Checkbox + help text above the palette in ColorSet.jsx
Render applyConfiguredItemColors() injects series[i].color from style.color (skips when legend active)
Dependency patch-package patch for @dhis2/analytics so the chart adapter honours a per-series colour

Caveats (prototype scope)

  • ⚠️ Does not persist yet — backend dependency. useItemColor is not a property on the DHIS2 Visualization schema, so on save the backend silently drops it (metadata import ignores unknown properties) and the toggle resets on reload. The colour applies at render time and survives an in-session Update, but not save/reload.
  • Column charts only validated.
  • Analytics behaviour shipped as a patch-package patch; the one-line change belongs upstream in @dhis2/analytics for a real feature.
  • No tests added.

AI Assisted

Prototype toggle in Style -> Color set: "Use configured item color when
available". When on (and legend is off), each data element / indicator with a
configured style.color uses it instead of the color set; items without one
fall back to the palette. Precedence: legend > configured item color > color
set.

Includes a patch-package patch to @dhis2/analytics so the chart series
adapter honors a per-series color instead of always overwriting it from the
color set (the one-line change belongs upstream for a real feature).

Scope: column charts validated. Not for merge.

AI Assisted
@karolinelien karolinelien changed the title [PROTOTYPE] feat: apply configured data element/indicator color [PROTOTYPE] DRAFT apply configured data element/indicator color Jun 2, 2026
@sonarqubecloud
Copy link
Copy Markdown

sonarqubecloud Bot commented Jun 2, 2026

@dhis2-bot
Copy link
Copy Markdown
Contributor

🚀 Deployed on https://pr-3469.data-visualizer.netlify.dhis2.org

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