Conditional formatting: Give each unique value in a column its own color (or read color from a column, or color ranges with more options)
- 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.**
I'm trying to write queries that make it easy to see which rows share a particular column value. For example, if I was looking at a list of orders from customers, I might want to know at glance whether a customer is consistently ordering the same product or different products over time. Or notice a cluster of orders in a row from the same customer. But it's hard to spot those patterns in a subtle change of ID number, and my real data doesn't always have a more conspicuously different field like a name associated with it.
**Describe the solution you'd like**
Being able to tint each row uniquely by a specific column value would be ideal. (That implies #15692 being done, but tinting just the column would still be an improvement.)
I don't especially care what colors get assigned as long as they're distinct, to the extent that's possible for the data (I realize that 500 different colors wouldn't be very distinct, but I don't have 500 different values in the queries where I want this).
**Describe alternatives you've considered**
Not viable:
* When I have five or fewer distinct values, a color range works. But my hypothetical storefront (and my real, more abstract dataset) has at least six different values.
* I'm aware that I could manually assign colors to specific values, but there are way too many possible values for that to be feasible. Any given instance of the query might have only a dozen distinct values, but those are filtered from a pool of thousands.
* Using some kind of chart to group values wouldn't help me at all because I need to see the rest of the fields in the results also.
Viable:
* If #9682 were implemented for conditional formatting, that would work too -- I can generate hex values myself and store them in a hidden field. But this request seemed distinct enough to list separately.
* Changing the background color for rows based only on whether a particular column value is different from the previous row wouldn't completely solve the problem but it would definitely be an improvement.
* I could generate an additional column on the fly with some sort of arbitrary value that's more visibly distinct than the ID (like #, ##, ### and so on) which would be an eyesore but at least help a little bit. (Actually, I just realized I could do that and then manually assign colors to _those_, which would be a hassle to implement but get me what I want. If I have time I'll try it and report back if it works.)
**How important is this feature to you?**
Fairly important. It's come up a number of times for different datasets. It's not a complete blocker because I can still write the queries, but it prevents me from creating a useful data visualization from those queries, which is the thing I want Metabase for -- the results I get without it are only about as useful as bare SQL output would be.
Contributor guide
Research direction
The issue names no files, tests, or entry points. Start by locating Metabase's conditional-formatting implementation and query-results visualization code, then determine how unique column values should receive distinct colors. Done means query results can color rows or columns by value, with useful behavior when many distinct values exist.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- clojure
- Domain
- data-visualization
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 30/100