Skip to content
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: explicit distribute columns on BoxPlot and apply time grain #21593

Merged
merged 10 commits into from
Sep 28, 2022

Conversation

zhaoyongjie
Copy link
Member

@zhaoyongjie zhaoyongjie commented Sep 27, 2022

SUMMARY

This PR intends to improve BoxPlot UX and apply Time Grain to all of the time columns in the Distribute Across control.

Originally, the default time column implicitly apply in the Distribute Across control until there are some columns set on this control. After this PR the default time column will explicitly display in Distribute Across.

Additionally, the Time Grian also move below Distribute Across control and the time grain would apply to all of the time columns.

BEFORE/AFTER SCREENSHOTS OR ANIMATED GIF

After

BoxPlot.mov

TESTING INSTRUCTIONS

ADDITIONAL INFORMATION

  • Has associated issue:
  • Required feature flags:
  • Changes UI
  • Includes DB Migration (follow approval process in SIP-59)
    • 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

@codecov
Copy link

codecov bot commented Sep 27, 2022

Codecov Report

Merging #21593 (b5b4184) into master (15c3c34) will decrease coverage by 0.00%.
The diff coverage is 58.33%.

❗ Current head b5b4184 differs from pull request most recent head eb4acc6. Consider uploading reports for the commit eb4acc6 to get more accurate results

@@            Coverage Diff             @@
##           master   #21593      +/-   ##
==========================================
- Coverage   66.72%   66.72%   -0.01%     
==========================================
  Files        1796     1797       +1     
  Lines       68731    68751      +20     
  Branches     7316     7323       +7     
==========================================
+ Hits        45864    45877      +13     
- Misses      21007    21013       +6     
- Partials     1860     1861       +1     
Flag Coverage Δ
javascript 52.98% <58.33%> (+<0.01%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

Impacted Files Coverage Δ
...d/packages/superset-ui-chart-controls/src/index.ts 100.00% <ø> (ø)
...chart-controls/src/shared-controls/dndControls.tsx 58.33% <ø> (ø)
...t-ui-chart-controls/src/shared-controls/mixins.tsx 33.33% <0.00%> (ø)
...s/plugin-chart-echarts/src/BoxPlot/controlPanel.ts 5.55% <0.00%> (-11.12%) ⬇️
...ins/plugin-chart-echarts/src/BoxPlot/buildQuery.ts 60.00% <60.00%> (-23.34%) ⬇️
...d/packages/superset-ui-chart-controls/src/types.ts 100.00% <100.00%> (ø)
...-ui-chart-controls/src/utils/getTemporalColumns.ts 100.00% <100.00%> (ø)
...packages/superset-ui-core/src/query/types/Query.ts 100.00% <100.00%> (ø)

📣 We’re building smart automated test selection to slash your CI/CD build times. Learn more

Copy link
Member

@villebro villebro left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A few comments, curious to hear your thoughts

Comment on lines +34 to +46
if (
isPhysicalColumn(col) &&
formData.time_grain_sqla &&
formData?.datetime_columns_lookup?.[col]
) {
return {
timeGrain: formData.time_grain_sqla,
columnType: 'BASE_AXIS',
sqlExpression: col,
label: col,
expressionType: 'SQL',
} as AdhocColumn;
}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we want to check for the GENERIC_CHART_AXES FF here similar to what we're doing in the other plugins?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Boxplot is a bit special. the Distribute Across is similar to XAxis control in time series charts, but the Distribute Across control is shown even though FF is disabled(the original logic). So the build query logic skips checking FF, which means always transforming the Physical Column into BaseAxisAdhocColumn.

Additionally, the Distribute Across control use the initialValue property to set the initial value as the default time column, so the BoxPlot is "native" to support generic xaxis.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Got it, thanks for the explanation. There may be the special case where a user wants to apply a time grain on "Dimensions" but not "Distribute across" or vice versa. But maybe that can be addressed once time grain is moved into the column control.

Copy link
Member

@villebro villebro left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

Comment on lines +34 to +46
if (
isPhysicalColumn(col) &&
formData.time_grain_sqla &&
formData?.datetime_columns_lookup?.[col]
) {
return {
timeGrain: formData.time_grain_sqla,
columnType: 'BASE_AXIS',
sqlExpression: col,
label: col,
expressionType: 'SQL',
} as AdhocColumn;
}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Got it, thanks for the explanation. There may be the special case where a user wants to apply a time grain on "Dimensions" but not "Distribute across" or vice versa. But maybe that can be addressed once time grain is moved into the column control.

@zhaoyongjie zhaoyongjie merged commit 93f08e7 into apache:master Sep 28, 2022
@mistercrunch mistercrunch added 🏷️ bot A label used by `supersetbot` to keep track of which PR where auto-tagged with release labels 🚢 2.1.0 and removed 🚢 2.1.3 labels Mar 13, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🏷️ bot A label used by `supersetbot` to keep track of which PR where auto-tagged with release labels size/XL 🚢 2.1.0
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants