Stefan781 opened a new issue, #25464:
URL: https://github.com/apache/superset/issues/25464

   I have a custom color palette that I would like to use to represent 
different groups in my charts. Here is the palette:
   <img width="179" alt="image" 
src="https://github.com/apache/superset/assets/130654984/92a9496f-8d73-4dc7-89ea-7315ca77dc25";>
   I have values that are dynamically calculated. I would like to assign the 
first color to the first value, based on some predefined condition. For 
example, alphabetical order. I have tried achieving this in multiple ways. When 
it comes to DeckGL graphs, it proved impossible, since the colors are assigned 
to their corresponding value in some arbitrary way, which is, to my 
disappointment, not controlled by the order defined in my dataset, created with 
a custom SQL query. When it comes to a pie chart, you have the option to _sort 
by metric_. With some "hacking" of the metric in a way that assigns a number 
based on the group so that the groups can be sorted in order, I get the desired 
result:
   
![image](https://github.com/apache/superset/assets/130654984/7f89b69e-21e8-41c9-bb56-aaaf9931f09c)
   However, if the metric changes to something meaningful, such as COUNT(*), 
the colors are still assigned based on the metric, not on my custom order:
   
![image](https://github.com/apache/superset/assets/130654984/a9420a13-8f8a-4a9a-a7a6-122d0d9c3218)
   Furthermore, even with the first approach, when applying filters, the color 
order breaks again:
   
![image](https://github.com/apache/superset/assets/130654984/5a71525d-bc95-4cfa-ae0b-bb9837b2c874)
   
   What I would like to be able to is to have a precise rule that defines how 
are the colors assigned. As a matter of fact, if the colors were assigned based 
on the defined ORDER BY in the SQL code, I would get my desired result. Are 
there any workarounds to this problem? Is my approach wrong and is there a 
better one? If not, are there plans to give more freedom when it comes to 
assigning colors to the charts?
   
   There is also the option to "hardcode" the color from the Dasbhoard 
settings. This, unfortunately, will not work in my case, since the groups will 
change dynamically if, for example, the max value becomes 20.
   
   I see different use cases for this functionality. The two cases I am 
interested in are:
   1. Monochrome colors for points on a Scatterplot DeckGL visualization based 
on some metric (for example, older points get a pale color). I actually came up 
with a workaround to this use case using a rather involved custom JS 
Interceptor but it still doesn't solve the problem if the user wants a specific 
color.
   2. Monochrome/Analogic colors in Part of a Whole charts for cases where the 
range of values has a different order than the metric that is used to order 
them and the represented values can change dynamically.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscr...@superset.apache.org.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscr...@superset.apache.org
For additional commands, e-mail: notifications-h...@superset.apache.org

Reply via email to