statgl_plot: series_tags, general two-group, named palette#41
Merged
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Three additive changes driven by the climate-page station-filter
use case in statwww:
New
series_tagsarg attaches per-series metadata as series.options.tags[], for downstream JS (e.g. the statglshortcodesfiltershortcode) 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.paletteaccepts 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
linkedTodirection 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 youwant one.
Each two-group series now also carries
g1_labelinternally so the tooltip and series_tags can key off it instead of re-parsing series.name (which has been renamed to g2).