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(plugin-chart-echarts): add support for generic axis to mixed chart #20097

Merged
merged 5 commits into from
May 19, 2022

Conversation

villebro
Copy link
Member

@villebro villebro commented May 17, 2022

SUMMARY

Add support for generic x-axis to Mixed Time-Series chart. In addition do the following changes:

  • Make the chart name and description dependent on the feature flag
  • Implement temporal x-axis scaling that was introduced in fix(plugin-chart-echarts): xAxis scale is not correct when time grain is quarter  #19686
  • Remove the "Predictive" tag from the Mixed chart (it doesn't support the predictive analytics functionality)
  • Explicitly support null values on the control panel section config and make the check explicit with a type guard
  • Minor refactoring/cleanup

AFTER

When the feature flag is enabled, the x-axis control appears, making it possible to use a non-temporal x-axis:
image

Now the chart is called "Mixed chart" instead of "Mixed Time-series Chart":
image

TESTING INSTRUCTIONS

  1. Enable GENERIC_CHART_AXES feature flag
  2. Go to chart picker and notice that Mixed time-series chart has been replaced with Mixed chart with a description that doesn't mention the words "timeseries" or "temporal"

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

@stephenLYZ
Copy link
Member

/testenv up FEATURE_GENERIC_CHART_AXES=true

@github-actions
Copy link
Contributor

@stephenLYZ Container image not yet published for this PR. Please try again when build is complete.

@github-actions
Copy link
Contributor

@stephenLYZ Ephemeral environment creation failed. Please check the Actions logs for details.

@villebro
Copy link
Member Author

/testenv up FEATURE_GENERIC_CHART_AXES=true

@github-actions
Copy link
Contributor

@villebro Ephemeral environment spinning up at http://34.215.190.191:8080. Credentials are admin/admin. Please allow several minutes for bootstrapping and startup.

@codecov
Copy link

codecov bot commented May 18, 2022

Codecov Report

Merging #20097 (11a1d13) into master (1fe30f1) will decrease coverage by 0.00%.
The diff coverage is 28.57%.

@@            Coverage Diff             @@
##           master   #20097      +/-   ##
==========================================
- Coverage   66.46%   66.45%   -0.01%     
==========================================
  Files        1721     1721              
  Lines       64467    64475       +8     
  Branches     6795     6804       +9     
==========================================
+ Hits        42847    42848       +1     
- Misses      19892    19895       +3     
- Partials     1728     1732       +4     
Flag Coverage Δ
javascript 51.35% <28.57%> (-0.01%) ⬇️

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

Impacted Files Coverage Δ
...chart-echarts/src/MixedTimeseries/controlPanel.tsx 86.66% <0.00%> (-6.20%) ⬇️
.../plugin-chart-echarts/src/MixedTimeseries/index.ts 25.00% <0.00%> (-25.00%) ⬇️
...hart-echarts/src/MixedTimeseries/transformProps.ts 0.00% <0.00%> (ø)
.../plugin-chart-echarts/src/Timeseries/buildQuery.ts 66.66% <ø> (-4.77%) ⬇️
...nd/src/explore/controlUtils/getSectionsToRender.ts 80.00% <ø> (-0.96%) ⬇️
...d/plugins/plugin-chart-echarts/src/utils/series.ts 87.50% <20.00%> (-4.50%) ⬇️
...d/packages/superset-ui-chart-controls/src/types.ts 100.00% <100.00%> (ø)
...in-chart-echarts/src/MixedTimeseries/buildQuery.ts 100.00% <100.00%> (ø)
...gin-chart-echarts/src/Timeseries/transformProps.ts 58.94% <100.00%> (+2.08%) ⬆️
...tend/plugins/plugin-chart-echarts/src/constants.ts 100.00% <100.00%> (ø)

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 1fe30f1...11a1d13. Read the comment docs.

@villebro
Copy link
Member Author

An example chart on the eph env: http://34.215.190.191:8080/superset/explore/p/gG3OYRVY0wj/

@@ -447,4 +447,12 @@ const config: ControlPanelConfig = {
],
};

if (isFeatureEnabled(FeatureFlag.GENERIC_CHART_AXES)) {
Copy link
Member

Choose a reason for hiding this comment

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

Can we just use ternary operator when declaring config? Like

isFeatureEnabled(FeatureFlag.GENERIC_CHART_AXES)) ? 
  { label: t('Shared query fields'),
    expanded: true,
    controlSetRows: [[xAxisControl]],
  } : sections.legacyTimeseriesTime

Copy link
Member Author

Choose a reason for hiding this comment

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

We still need the time section (I hope we can get rid of it soon, but it'll require some more work that's beyond the scope of this PR)

Copy link
Member

@kgabryje kgabryje May 18, 2022

Choose a reason for hiding this comment

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

Sorry, I meant to write

isFeatureEnabled(FeatureFlag.GENERIC_CHART_AXES)) ? 
  { label: t('Shared query fields'),
    expanded: true,
    controlSetRows: [[xAxisControl]],
  } : null

🤦
I think that's a pattern that we use in several control panels

Copy link
Member Author

Choose a reason for hiding this comment

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

oh right, I forgot about that pattern 👍

Copy link
Member Author

@villebro villebro May 18, 2022

Choose a reason for hiding this comment

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

Actually this currently only applies to controls, not control sections. But I added the null option to sections, too (tested that it works exactly like for controls): 60e7ba0 and 11a1d13

Copy link
Member

@kgabryje kgabryje left a comment

Choose a reason for hiding this comment

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

Tested, LGTM

@villebro villebro merged commit d5c5e58 into apache:master May 19, 2022
@villebro villebro deleted the villebro/mixed-generic branch May 19, 2022 10:52
@github-actions
Copy link
Contributor

Ephemeral environment shutdown and build artifacts deleted.

philipher29 pushed a commit to ValtechMobility/superset that referenced this pull request Jun 9, 2022
…rt (apache#20097)

* feat(plugin-chart-echarts): add support for generic axis to mixed chart

* fix tests + add new tests

* address review comments

* simplify control panel

* fix types and tests
@mistercrunch mistercrunch added 🏷️ bot A label used by `supersetbot` to keep track of which PR where auto-tagged with release labels 🚢 2.0.0 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 preset-io size/L 🚢 2.0.0
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants