-
Notifications
You must be signed in to change notification settings - Fork 15.3k
feat(deckgl): add new color controls with color breakpoints #34017
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat(deckgl): add new color controls with color breakpoints #34017
Conversation
Based on your review schedule, I'll hold off on reviewing this PR until it's marked as ready for review. If you'd like me to take a look now, comment
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Review by Korbit AI
Korbit automatically attempts to detect when you fix issues in new commits.
Category | Issue | Status |
---|---|---|
Missing Color Breakpoints Validation ▹ view | 🧠 Not in standard | |
Redundant Interface Properties ▹ view | 🧠 Not in scope | |
Conflicting popover control props ▹ view | 🧠 Not in scope | |
Mixed Layer and Aggregation Logic ▹ view | 🧠 Not in scope | |
Misleading Component Name ▹ view | 🧠 Incorrect | |
Unexplained Empty Function Prop ▹ view | 🧠 Incorrect | |
Missing color scheme type usage guidance ▹ view | 🧠 Not in scope | |
Incomplete Drag and Drop Implementation ▹ view | 🧠 Incorrect | |
Array Indices Used As IDs ▹ view | 🧠 Not in standard | |
Ambiguous boolean parameter name ▹ view | 🧠 Not in scope |
Files scanned
Due to the exceptionally large size of this PR, I've limited my review to the following files:
File Path | Reviewed |
---|---|
superset-frontend/plugins/legacy-preset-chart-deckgl/src/types.ts | ✅ |
superset-frontend/plugins/legacy-preset-chart-deckgl/src/utilities/utils.ts | ✅ |
superset-frontend/plugins/legacy-preset-chart-deckgl/src/layers/Grid/controlPanel.ts | ✅ |
superset-frontend/plugins/legacy-preset-chart-deckgl/src/layers/Hex/controlPanel.ts | ✅ |
superset-frontend/src/explore/components/controls/ContourControl/ContourOption.tsx | ✅ |
superset-frontend/plugins/legacy-preset-chart-deckgl/src/layers/Heatmap/Heatmap.tsx | ✅ |
superset-frontend/src/explore/components/controls/ColorBreakpointsControl/ColorBreakpointPopoverTrigger.tsx | ✅ |
superset-frontend/plugins/legacy-preset-chart-deckgl/src/layers/Screengrid/controlPanel.ts | ✅ |
superset-frontend/plugins/legacy-preset-chart-deckgl/src/components/Legend.tsx | ✅ |
superset-frontend/plugins/legacy-preset-chart-deckgl/src/layers/Arc/Arc.tsx | ✅ |
superset-frontend/src/explore/components/controls/ColorBreakpointsControl/ColorBreakpointOption.tsx | ✅ |
superset-frontend/src/explore/components/controls/index.js | ✅ |
superset-frontend/src/explore/components/controls/ColorBreakpointsControl/types.ts | ✅ |
superset-frontend/plugins/legacy-preset-chart-deckgl/src/layers/Scatter/controlPanel.ts | ✅ |
superset-frontend/plugins/legacy-preset-chart-deckgl/src/layers/Grid/Grid.tsx | ✅ |
superset-frontend/plugins/legacy-preset-chart-deckgl/src/layers/Heatmap/controlPanel.ts | ✅ |
superset-frontend/plugins/legacy-preset-chart-deckgl/src/layers/Hex/Hex.tsx | ✅ |
superset-frontend/plugins/legacy-preset-chart-deckgl/src/factory.tsx | ✅ |
superset-frontend/src/explore/components/controls/ColorBreakpointsControl/index.tsx | ✅ |
superset-frontend/plugins/legacy-preset-chart-deckgl/src/layers/Polygon/controlPanel.ts | ✅ |
superset-frontend/plugins/legacy-preset-chart-deckgl/src/layers/common.tsx | ✅ |
superset-frontend/plugins/legacy-preset-chart-deckgl/src/layers/Arc/controlPanel.ts | ✅ |
superset-frontend/plugins/legacy-preset-chart-deckgl/src/utils.ts | ✅ |
superset-frontend/plugins/legacy-preset-chart-deckgl/src/layers/Screengrid/Screengrid.tsx | ✅ |
superset-frontend/plugins/legacy-preset-chart-deckgl/src/CategoricalDeckGLContainer.tsx | ✅ |
superset-frontend/plugins/legacy-preset-chart-deckgl/src/layers/Polygon/Polygon.tsx | ✅ |
superset-frontend/src/explore/components/controls/ColorBreakpointsControl/ColorBreakpointPopoverControl.tsx | ✅ |
superset-frontend/packages/superset-ui-chart-controls/src/types.ts | ✅ |
superset-frontend/plugins/legacy-preset-chart-deckgl/src/utilities/Shared_DeckGL.tsx | ✅ |
Explore our documentation to understand the languages and file types we support and the files we ignore.
Check out our docs on how you can make Korbit work best for you and your team.
['color_scheme'], | ||
...generateDeckGLColorSchemeControls({ | ||
defaultSchemeType: COLOR_SCHEME_TYPES.categorical_palette, | ||
disableCategoricalColumn: true, |
This comment was marked as resolved.
This comment was marked as resolved.
Sorry, something went wrong.
name: 'color_scheme_type', | ||
config: { | ||
type: 'SelectControl', | ||
label: t('Color Scheme Type'), | ||
clearable: false, | ||
validators: [], | ||
choices: [ | ||
[COLOR_SCHEME_TYPES.fixed_color, t('Fixed color')], | ||
[COLOR_SCHEME_TYPES.linear_palette, t('Linear palette')], | ||
], | ||
default: COLOR_SCHEME_TYPES.linear_palette, | ||
}, |
This comment was marked as resolved.
This comment was marked as resolved.
Sorry, something went wrong.
defaultOpen={visible} | ||
open={visible} |
This comment was marked as resolved.
This comment was marked as resolved.
Sorry, something went wrong.
const colorAggFunc = | ||
colorSchemeType === COLOR_SCHEME_TYPES.color_breakpoints | ||
? (p: number[]) => getColorForBreakpoints(aggFunc, p, colorBreakpoints) | ||
: aggFunc; |
This comment was marked as resolved.
This comment was marked as resolved.
Sorry, something went wrong.
const aggFunc = getAggFunc(fd.js_agg_function, p => p.weight); | ||
|
||
const colorAggFunc = | ||
colorSchemeType === COLOR_SCHEME_TYPES.color_breakpoints | ||
? (p: number[]) => getColorForBreakpoints(aggFunc, p, colorBreakpoints) | ||
: aggFunc; |
This comment was marked as resolved.
This comment was marked as resolved.
Sorry, something went wrong.
export interface ColorBreakpointsPopoverTriggerProps { | ||
description?: string; | ||
hovered?: boolean; | ||
value?: ColorBreakpointType; | ||
children?: ReactNode; | ||
saveColorBreakpoint: (colorBreakpoint: ColorBreakpointType) => void; | ||
isControlled?: boolean; | ||
visible?: boolean; | ||
toggleVisibility?: (visibility: boolean) => void; | ||
colorBreakpoints: ColorBreakpointType[]; | ||
} | ||
|
||
export interface ColorBreakpointsPopoverControlProps { | ||
description?: string; | ||
hovered?: boolean; | ||
value?: ColorBreakpointType; | ||
onSave?: (colorBreakpoint: ColorBreakpointType) => void; | ||
onClose?: () => void; | ||
colorBreakpoints: ColorBreakpointType[]; | ||
} |
This comment was marked as resolved.
This comment was marked as resolved.
Sorry, something went wrong.
|
||
const DEFAULT_COLOR_BREAKPOINTS: ColorBreakpointType[] = []; | ||
|
||
const NewContourFormatPlaceholder = styled('div')` |
This comment was marked as resolved.
This comment was marked as resolved.
Sorry, something went wrong.
colorBreakpoints={colorBreakpoints} | ||
index={index} | ||
onClose={removeColorBreakpoint} | ||
onShift={() => {}} |
This comment was marked as resolved.
This comment was marked as resolved.
Sorry, something went wrong.
onDrop={() => {}} | ||
canDrop={() => true} |
This comment was marked as resolved.
This comment was marked as resolved.
Sorry, something went wrong.
const editColorBreakpoint = ( | ||
breakpoint: ColorBreakpointType, | ||
index: number, | ||
) => { | ||
const newBreakpoints = [...colorBreakpoints]; | ||
newBreakpoints[index] = { | ||
...breakpoint, | ||
id: index, | ||
}; | ||
setColorBreakpoints(newBreakpoints); | ||
}; |
This comment was marked as resolved.
This comment was marked as resolved.
Sorry, something went wrong.
0d197a2
to
2503e14
Compare
Very cool! Looks like it needs a rebase, but I'll spin up a test environment in the meantime. |
@rusackas Processing your ephemeral environment request here. Action: up. More information on how to use or configure ephemeral environments |
@rusackas Ephemeral environment spinning up at http://34.214.104.35:8080. Credentials are 'admin'/'admin'. Please allow several minutes for bootstrapping and startup. |
@@ -190,3 +192,19 @@ export function getBuckets( | |||
|
|||
return buckets; | |||
} | |||
|
|||
export function getColorBreakpointsBuckets(fd: QueryFormData) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: maybe this function could accepts only the breakpoints as the argument instead of the whole form data object? That way we might avoid some rerenders caused by passing form data to a dependency array in useEffect
/* eslint camelcase: 0 */ | ||
|
||
export function formatSelectOptions(options: (string | number)[]) { | ||
return options.map(opt => [opt, opt.toString()]); | ||
} | ||
|
||
export const getSelectedColorSchemeType = ( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do we need this function? Can't we just call formData.color_scheme_type directly?
height: ${({ theme }) => theme.sizeUnit * 3}px; | ||
border-radius: ${({ theme }) => theme.sizeUnit / 2}px; | ||
background: ${(props: { color: string }) => props.color}; | ||
margin-right: ${({ theme }) => theme.sizeUnit * 1.5}px; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we use the full size units? Whatever looks better, theme.sizeUnit or theme.sizeUnit *2
Thanks @rusackas! It does, but the bump of the deck.gl dependencies in #33603 broke the deck.gl charts for me on local env in the master branch. Is it just me, or should I revert the deck.gl packages versions bump on this branch? |
Same here , it breaks on local setup @DamianPendrak , #33603 ... tried to fix it while maintaining the changes from the open street maps ... but it keeps on breaking |
…ategories for color breakpoints
11f614b
to
cb93580
Compare
…t and make "tile-providers" more configurable (apache#33603)" This reverts commit d951158.
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## master #34017 +/- ##
===========================================
+ Coverage 0 72.98% +72.98%
===========================================
Files 0 559 +559
Lines 0 40516 +40516
Branches 0 4267 +4267
===========================================
+ Hits 0 29571 +29571
- Misses 0 9836 +9836
- Partials 0 1109 +1109
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
@@ -84,6 +84,9 @@ export const getLayer: GetLayerType<HexagonLayer> = function ({ | |||
? (p: number[]) => getColorForBreakpoints(aggFunc, p, colorBreakpoints) | |||
: aggFunc; | |||
|
|||
console.log('colorBreakpoints', colorBreakpoints); | |||
console.log('colorRange', colorRange); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could you remove the console logs?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done
@kgabryje Processing your ephemeral environment request here. Action: up. More information on how to use or configure ephemeral environments |
@kgabryje Ephemeral environment spinning up at http://54.203.127.237:8080. Credentials are 'admin'/'admin'. Please allow several minutes for bootstrapping and startup. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Works great! LGTM
Looks like this PR has bad merge conflicts and reverted things that were set up in #33603 (comment). |
@mistercrunch yes, I didn't manage to bring back the revert before merging to master, as I explained in #34123 (comment) |
Oh so this was this intentional then? Not sure if the reviewer/merger knew we were reverting a PR as part of this one. I created #34176 thinking this was a mistake, but unclear if / what is the path forward. I'm not sure why these 2 PRs had to be mutually exclusive but you all should work on a fix, happy to review. |
I'm sorry, I didn't communicate that here, my mistake. I was going to bring back the reverted PR, but it got merged before passing QA. The #33603 breaks all deck.gl Charts on local environment, but I thought it breaks on ephemeral too, so I reverted it |
Oh I wasn't clear on #33603 breaking deck.gl - are we sure that's the case? |
Yes, only breaking local environment with Docker is confirmed. Not sure about ephemeral env, but @amaannawab923 says it should work on ephemeral as building with |
Good to know, do we know more about what's happening? I think I see this in my console:
But there are so many other messages in the damn console that I can't tell if that's the actual/exact issue. We'll take on cleaning up the console, but in the meantime we should get to the bottom of this.... So somehow |
@mistercrunch |
SUMMARY
Add new Controls that handle fixed colors, palette, and color breakpoints based on selection. Implement new color breakpoints Control to set colors of the Deck.gl Charts based on the Metric value.
BEFORE/AFTER SCREENSHOTS OR ANIMATED GIF
TESTING INSTRUCTIONS
ADDITIONAL INFORMATION