metabase / metabase/metabase

Allow disabling hash-based color mapping for < 8 categories

Open
#30,890 1 comment 1 reaction 0 assignees View on GitHub

Nobody has claimed this yet.

Type:New Feature Visualization/
Dominant language
Clojure
Stars
49.3k
Forks
6.8k
Avg merge
1d 13h
Merged PRs (30d)
653

Description

**Is your feature request related to a problem? Please describe.**
Our color palette works well when it is always ordered. One example of this is that we have a gradient from dark to light blue. [When there are < 8 categories, Metabase defaults to hash-based mapping](https://github.com/metabase/metabase/blob/master/frontend/src/metabase/lib/colors/charts.ts) and so the ordering of things like pie charts look very strange.

**Describe the solution you'd like**
Ideally we'd like to remove hash-based mapping altogether, but at a minimum we want the ability to override it in individual questions and/or dashboards or default.

**Describe alternatives you've considered**
There aren't really any alternatives, because we want control over our colors and we're multitenant with one backing global table because Metabase doesn't support parameterizing by table (#11052 ). This means that manually changing colors will result in even worse results for other customers.

**How important is this feature to you?**
Really, really important! Either this or #11052 is a blocker for us to keep using Metabase (currently on Pro plan)

**Additional context**
Using sample dataset and making a pie chart viz
```
SELECT "PUBLIC"."ACCOUNTS"."PLAN" AS "PLAN", COUNT(*) AS "count"
FROM "PUBLIC"."ACCOUNTS"
GROUP BY "PUBLIC"."ACCOUNTS"."PLAN"
ORDER BY "PUBLIC"."ACCOUNTS"."PLAN" ASC
```

Screenshot 2023-05-19 at 4 40 47 PM

color palette is basically a gradient:
```
#032CA5
#1246E0
#265CFF
#658DFD
#93AEFF
#C1D2FE
#E3EBFF
#F5F8FF
```

(We'd fill in the rest of the palette, but this is enough to reproduce the issue)
Screenshot 2023-05-19 at 4 50 06 PM

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Read frontend/src/metabase/lib/colors/charts.ts first to understand the current hash-based mapping for fewer than eight categories. Trace how color settings reach individual questions or dashboards, then define and verify an override that preserves ordered palette colors when enabled.

Written by the indexing model from the issue text.

Assessment

Tech stack
typescript
Domain
data-visualization, frontend
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.