You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@superset.apache.org by "villebro (via GitHub)" <gi...@apache.org> on 2023/04/12 09:24:31 UTC

[GitHub] [superset] villebro opened a new pull request, #23657: feat(dashboard): make color indices referable

villebro opened a new pull request, #23657:
URL: https://github.com/apache/superset/pull/23657

   ### SUMMARY
   Currently it's only possible to assign series colors on dashboards based on the color names (e.g. "red") or hex codes (e.g. "#FF0000"). This PR adds the option to assign colors based on the color scheme index. This ensures that the color will be fixed, but also makes it adapt to whichever color scheme is chosen.
   
   ### SCREENSHOT
   Here we're using the "D3 category 10" scheme, and assign the 2 index (=third) for "boy" and "red" for "girl":
   ![image](https://user-images.githubusercontent.com/33317356/231413848-3b6f11c6-51d4-4bcd-a595-c615823f2ad7.png)
   
   After we do that, the charts update accordingly:
   ![image](https://user-images.githubusercontent.com/33317356/231414101-3fbc6387-96bc-40fd-bec1-11b6da278872.png)
   
   If we then change the scale to the "ECharts 5.0" scheme, the dashboard updates accordingly (notice "boy" turns yellow, while "girl" stays unchanged):
   ![image](https://user-images.githubusercontent.com/33317356/231414696-385589d3-0b92-464a-86db-88c1e05b6284.png)
   ![image](https://user-images.githubusercontent.com/33317356/231414769-8ad42447-963f-4b47-8024-3ca045304285.png)
   
   ### TESTING INSTRUCTIONS
   <!--- Required! What steps can be taken to manually verify the changes? -->
   
   ### ADDITIONAL INFORMATION
   <!--- Check any relevant boxes with "x" -->
   <!--- HINT: Include "Fixes #nnn" if you are fixing an existing issue -->
   - [ ] Has associated issue:
   - [ ] Required feature flags:
   - [ ] Changes UI
   - [ ] Includes DB Migration (follow approval process in [SIP-59](https://github.com/apache/superset/issues/13351))
     - [ ] Migration is atomic, supports rollback & is backwards-compatible
     - [ ] Confirm DB migration upgrade and downgrade tested
     - [ ] Runtime estimates and downtime expectations provided
   - [ ] Introduces new feature or API
   - [ ] Removes existing feature or API
   


-- 
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-unsubscribe@superset.apache.org

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


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


[GitHub] [superset] villebro commented on a diff in pull request #23657: feat(dashboard): make color indices referable

Posted by "villebro (via GitHub)" <gi...@apache.org>.
villebro commented on code in PR #23657:
URL: https://github.com/apache/superset/pull/23657#discussion_r1163867376


##########
superset-frontend/packages/superset-ui-core/src/color/CategoricalColorScale.ts:
##########
@@ -165,7 +175,7 @@ class CategoricalColorScale extends ExtensibleFunction {
    *
    * If there are fewer elements in the range than in the domain, the scale will reuse values from the start of the range.
    *
-   * @param range Array of range values.
+   * @param newRange Array of range values.

Review Comment:
   bycatch - incorrect `@param` name



-- 
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-unsubscribe@superset.apache.org

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


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


[GitHub] [superset] villebro merged pull request #23657: feat(dashboard): make color indices referable

Posted by "villebro (via GitHub)" <gi...@apache.org>.
villebro merged PR #23657:
URL: https://github.com/apache/superset/pull/23657


-- 
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-unsubscribe@superset.apache.org

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


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


[GitHub] [superset] villebro commented on a diff in pull request #23657: feat(dashboard): make color indices referable

Posted by "villebro (via GitHub)" <gi...@apache.org>.
villebro commented on code in PR #23657:
URL: https://github.com/apache/superset/pull/23657#discussion_r1163866643


##########
superset-frontend/packages/superset-ui-core/src/color/CategoricalColorScale.ts:
##########
@@ -39,7 +39,7 @@ class CategoricalColorScale extends ExtensibleFunction {
 
   scale: ScaleOrdinal<{ toString(): string }, string>;
 
-  parentForcedColors?: ColorsLookup;
+  parentForcedColors: ColorsLookup;

Review Comment:
   This is never `undefined` (see that it defaults to `{}` in the constructor)



-- 
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-unsubscribe@superset.apache.org

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


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