Set guaranteed colors for stacked bar chart categories (coming from variables)

Hi!

I have horizontal stacked bar chart and I pass parameters (variables) to it. The chart is then statically embedded into my web app.

In my chart these parameters become categories (bar sections (stacked) in a chart). I need to set specific guaranteed colors to these categories based on their order/variable name.

Example: variable1 will get dark green color, variable2 will get normal green, variable3 will get light green.

variable1, variable2, variable3 - can be any (string) values.

Is it possible in metabase at all?

See example:

here the names are variables, so every time I render this chart, the set of names will be different, however the colors should remain the same (dark green for {{name1}}, lighter green for {{name2}}, etc.)

From what I can see it is not possible. The colors are assigned to specific category values only. If the values changed the colors are reset to random values.

We are using Pro cloud plan.

Short of API hackery, I don’t think you can force series colors if the series names change between queries. Metabase remembers the colors assigned to series and recalls them if they disappear & reappear later. You can use Pro appearance settings to limit the color palette but those settings are global and it still doesn’t guarantee the order in which the colors are assigned.

If you transpose your axes–make the Y axis the name and the X breakout the activity–the colors will stay assigned to their respective activity.