Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add support for grouped legends #4964

Open
wants to merge 1 commit into
base: develop
Choose a base branch
from

Conversation

clementprdhomme
Copy link
Collaborator

@clementprdhomme clementprdhomme commented Mar 17, 2025

This PR adds support for grouped legends by reusing the “basic” legend type which already had most of the feature implemented.

Legend for the “Tree cover loss by dominant driver - 2001-2023” layer showing groups of items

To defined groups, nest an items array inside each item. You can test the implementation by defining a legend as follows:

{
  "type": "basic",
  "items": [
    {
      "name": "Drivers of temporary disturbances",
      "items": [
        {
          "name": "Forest management",
          "color": "#FF00DD"
        },
        {
          "name": "Shifting cultivation",
          "color": "#34EE64"
        },
        {
          "name": "Wildfires",
          "color": "#A200FF"
        },
        {
          "name": "Other natural disturbances",
          "color": "#DDD"
        },
      ]
    },
    {
      "name": "Drivers of deforestation",
      "items": [
        {
          "name": "Hard commodities",
          "color": "#FFDEDD"
        },
        {
          "name": "Permanent agriculture",
          "color": "#D4E36D"
        },
        {
          "name": "Settlements and infrastructure",
          "color": "#0200FF"
        }
      ]
    }
  ]
}

Tracking

FLAG-1231

Implementation reuse the “basic” legend type which already had most of the feature implemented. This commit add the styles.
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