Skip to content

statgl_plot: series_tags, general two-group, named palette#41

Merged
emilmalta merged 2 commits into
StatisticsGreenland:masterfrom
emilmalta:master
May 25, 2026
Merged

statgl_plot: series_tags, general two-group, named palette#41
emilmalta merged 2 commits into
StatisticsGreenland:masterfrom
emilmalta:master

Conversation

@emilmalta

Copy link
Copy Markdown
Collaborator

Three additive changes driven by the climate-page station-filter
use case in statwww:

  • New series_tags arg attaches per-series metadata as series.options.tags[], for downstream JS (e.g. the statglshortcodes filter shortcode) to read without relying on series-name matching. For two-group charts, tags are keyed by the g1 value so a single station filter matches both the max and min series for that station in one click.

  • group = c(g1, g2) now works outside pyramid mode as the general "groups by g1, colour by g2" overlay: g1 splits series, g2 drives colour and the legend (one entry per g2, series sharing a g2 are linkedTo each other). Replaces the manual two-plot palette splice for min/max-style overlays. Pyramid two-group behaviour is functionally unchanged.

  • palette accepts a named char vec for two-group charts, mapping g2 -> colour directly: palette = c(Maks = "#fa8b2a", Min = "#2caffe") The single-name and unnamed-vec forms still ramp across n_g2.

Behaviour changes worth flagging:

  • Pyramid two-group: the legend representative is now the first g1 level rather than the second. Labels, colours, and click-to-toggle behaviour are identical; only the internal linkedTo direction differs.

  • The auto legend title (g2 column name shown as a bold header above legend entries) is removed across the board. It read as raw column noise on non-pyramid two-group charts. Add a title explicitly via hc_legend(title = list(text = "...")) if you
    want one.

Each two-group series now also carries g1_label internally so the tooltip and series_tags can key off it instead of re-parsing series.name (which has been renamed to g2).

@emilmalta emilmalta merged commit 18d8d0d into StatisticsGreenland:master May 25, 2026
5 checks passed
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.

1 participant