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

[FLAG-1226] Support grouped legend in doughnut charts #4910

Merged
merged 5 commits into from
Jan 14, 2025

Conversation

willian-viana
Copy link
Collaborator

Overview

Support adding groups of legend items in doughnut charts. A legend item is composed of (1) a color swatch, (2) a label, and (3) a statistic.

Acceptance criteria

Groups stack vertically (i.e. flex-direction: column)

Items within a group wrap to form multiple rows if their total width exceeds the parent container (i.e. flex-wrap: wrap)

Groups can have an optional header with the following styles (anything not listed here should be the default for GFW’s typical style):

font-size: 14px

font-weight: bold

There should be a 5px gap between the optional header and the items in the group. This can be achieved though padding, margin, or any other styling that is convenient.

When the widget is shown in full width (e.g. on the dashboard), then the legend should appear to the left of the doughnut. (This is the current behavior).

When the widget is shown in smaller width (e.g. on the analysis panel on the map), then the legend should appear below the doughnut

Sample data for a country

  {
    "iso": "ALB",
    "drivers_type": "Forest management",
    "umd_tree_cover_loss__ha": 2024,
    "umd_tree_cover_loss__ha": 415.980,
  },
  ...
]

Possible values for drivers_type:

  • Drivers of non-permanent loss

    • Forest management
    • Shifting cultivation
    • Wildfires
    • Other natural disasters
  • Drivers of permanent deforestation

    • Hard commodities
    • Permanent agriculture
    • Settlements and infrastructure

Demo

Screenshot 2024-12-02 at 6 43 49 PM

@willian-viana willian-viana self-assigned this Jan 9, 2025
@willian-viana willian-viana marked this pull request as ready for review January 9, 2025 15:42
@willian-viana willian-viana temporarily deployed to gfw-staging-pr-4910 January 9, 2025 15:45 Inactive
@willian-viana willian-viana changed the title [FLAG-1226] [FLAG-1226] Support grouped legend in doughnut charts Jan 9, 2025
@willian-viana willian-viana temporarily deployed to gfw-staging-pr-4910 January 9, 2025 17:35 Inactive
@willian-viana willian-viana force-pushed the feat/grouped-legend-FLAG-1226 branch from 73e5e5b to 72e5e3a Compare January 9, 2025 17:36
@willian-viana willian-viana temporarily deployed to gfw-staging-pr-4910 January 9, 2025 17:36 Inactive
@willian-viana willian-viana requested a review from wri7tno January 9, 2025 17:37
Copy link
Collaborator

@wri7tno wri7tno left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@willian-viana willian-viana force-pushed the feat/grouped-legend-FLAG-1226 branch from 72e5e3a to 874379d Compare January 14, 2025 17:20
@willian-viana willian-viana temporarily deployed to gfw-staging-pr-4910 January 14, 2025 17:25 Inactive
@willian-viana willian-viana merged commit 6b6c12b into develop Jan 14, 2025
4 checks passed
@willian-viana willian-viana deleted the feat/grouped-legend-FLAG-1226 branch January 14, 2025 18:43
@willian-viana willian-viana mentioned this pull request Jan 14, 2025
willian-viana added a commit that referenced this pull request Jan 15, 2025
willian-viana added a commit that referenced this pull request Jan 15, 2025
Revert "Merge pull request #4910 from wri/feat/grouped-legend-FLAG-1226"
@willian-viana willian-viana restored the feat/grouped-legend-FLAG-1226 branch January 15, 2025 18:05
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