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: Migrates Area chart #23870

Closed
wants to merge 5 commits into from

Conversation

michael-s-molina
Copy link
Member

@michael-s-molina michael-s-molina commented Apr 28, 2023

SUMMARY

This PR migrates the Area chart to the ECharts version.

  • Removes the legacy Area chart code and unregisters the plugin.
  • Removes old plugin references throughout the codebase
  • Updates unit tests
  • Updates E2E tests
  • Updates the example dashboards
  • Updates translation files

Note a previous migration existed however the legacy chart wasn't removed and thus new legacy Area charts could have been created.

AFTER SCREENSHOT

Screenshot 2023-05-03 at 18 14 16

TESTING INSTRUCTIONS

1 - Make sure all Area (legacy) charts were converted to the ECharts version
2 - Make sure Area (legacy) is not available anymore in the viz picker
3 - Make sure that it's possible to revert the migration by executing superset db downgrade and reverting this PR

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

@michael-s-molina michael-s-molina added risk:breaking-change Issues or PRs that will introduce breaking changes hold! On hold v3.0 Label added by the release manager to track PRs to be included in the 3.0 branch labels May 1, 2023
@michael-s-molina michael-s-molina marked this pull request as ready for review May 1, 2023 17:21
@codecov
Copy link

codecov bot commented May 1, 2023

Codecov Report

Merging #23870 (d31f6e7) into master (7891cea) will increase coverage by 0.00%.
The diff coverage is 90.47%.

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

@@           Coverage Diff           @@
##           master   #23870   +/-   ##
=======================================
  Coverage   68.28%   68.29%           
=======================================
  Files        1955     1953    -2     
  Lines       75493    75499    +6     
  Branches     8220     8220           
=======================================
+ Hits        51553    51562    +9     
+ Misses      21833    21830    -3     
  Partials     2107     2107           
Flag Coverage Δ
hive 53.32% <10.00%> (-0.03%) ⬇️
javascript 54.68% <0.00%> (-0.01%) ⬇️
mysql 78.97% <95.00%> (+0.01%) ⬆️
postgres 79.04% <95.00%> (+0.01%) ⬆️
presto 53.24% <10.00%> (-0.03%) ⬇️
python 82.86% <95.00%> (+0.01%) ⬆️
sqlite 77.58% <95.00%> (+0.01%) ⬆️
unit 53.35% <0.00%> (-0.03%) ⬇️

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

Impacted Files Coverage Δ
...nd/plugins/legacy-preset-chart-nvd3/src/NVD3Vis.js 0.00% <ø> (ø)
...end/plugins/legacy-preset-chart-nvd3/src/preset.js 0.00% <ø> (ø)
...gin-chart-echarts/src/Timeseries/transformProps.ts 57.75% <0.00%> (ø)
...ponents/controls/VizTypeControl/VizTypeGallery.tsx 88.23% <ø> (ø)
...-frontend/src/visualizations/presets/MainPreset.js 100.00% <ø> (ø)
superset/examples/birth_names.py 70.00% <ø> (ø)
superset/examples/world_bank.py 31.57% <ø> (ø)
superset/viz.py 61.29% <ø> (-0.11%) ⬇️
...perset/migrations/shared/migrate_viz/processors.py 97.29% <95.00%> (-2.71%) ⬇️

... and 1 file with indirect coverage changes

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

remove_keys = {"contribution", "stacked_style", "x_axis_label"}
rename_keys = {
"x_axis_label": "x_axis_title",
"x_axis_format": "x_axis_time_format",
Copy link
Member

Choose a reason for hiding this comment

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

I'm surprised this has the term time in it given that I thought part of the broader EChart migration was to support time agnostic, i.e., generic, charts.

Copy link
Member Author

Choose a reason for hiding this comment

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

I find that weird too. After we migrate the legacy charts and find ourselves in a more consolidated state, we should have another round to polish the form data to rename/remove some keys.

rename_keys = {
"x_axis_label": "x_axis_title",
"x_axis_format": "x_axis_time_format",
"x_ticks_layout": "xAxisLabelRotation",
Copy link
Member

Choose a reason for hiding this comment

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

Why is there a mix of snake- and camel-case keys?

Copy link
Member Author

Choose a reason for hiding this comment

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

Because the controls were defined using non-standard nomenclature 😢

if self.data.get("contribution"):
self.data["contributionMode"] = "row"
if contribution := self.data.get("contribution"):
self.data["contributionMode"] = "row" if contribution else None
Copy link
Member

Choose a reason for hiding this comment

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

Given, per line #48, contribution is truthy this should reduce to:

if self.data.get("contribution"):
    self.data["contributionMode"] = "row"

Copy link
Member Author

Choose a reason for hiding this comment

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

This code will be inherited from the base TimeseriesChart that was created in the Line migration. I will rebase this PR on top of that one.

self.data["contributionMode"] = "row" if contribution else None

show_brush = self.data.get("show_brush")
self.data["zoomable"] = False if show_brush == "no" else True
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
self.data["zoomable"] = False if show_brush == "no" else True
self.data["zoomable"] = not self.data.get("show_brush") == "no"

Copy link
Member Author

@michael-s-molina michael-s-molina May 23, 2023

Choose a reason for hiding this comment

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

This code will be inherited from the base TimeseriesChart that was created in the Line migration. I will rebase this PR on top of that one.

self.data["x_axis_title"] = x_axis_label
self.data["x_axis_title_margin"] = 30
if x_ticks_layout := self.data.get("x_ticks_layout"):
self.data["x_ticks_layout"] = 45 if x_ticks_layout == "45°" else 0
Copy link
Member

Choose a reason for hiding this comment

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

Is 0 akin to None or undefined? If so there's probably no need to set it.

Copy link
Member Author

Choose a reason for hiding this comment

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

No. It should be a number to match the type definition.

self.data["opacity"] = 0.7

if rolling_type := self.data.get("rolling_type"):
self.data["rolling_type"] = None if rolling_type == "None" else rolling_type
Copy link
Member

Choose a reason for hiding this comment

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

Copy link
Member Author

Choose a reason for hiding this comment

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

This code will be inherited from the base TimeseriesChart that was created in the Line migration. I will rebase this PR on top of that one.

x_axis_label = self.data.get("x_axis_label")
bottom_margin = self.data.get("bottom_margin")
if x_axis_label and (not bottom_margin or bottom_margin == "auto"):
self.data["bottom_margin"] = 30
Copy link
Member

@john-bodley john-bodley May 22, 2023

Choose a reason for hiding this comment

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

Copy link
Member Author

Choose a reason for hiding this comment

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

This code will be inherited from the base TimeseriesChart that was created in the Line migration. I will rebase this PR on top of that one.


x_axis_label = self.data.get("x_axis_label")
bottom_margin = self.data.get("bottom_margin")
if x_axis_label and (not bottom_margin or bottom_margin == "auto"):
Copy link
Member

Choose a reason for hiding this comment

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

Copy link
Member Author

Choose a reason for hiding this comment

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

This code will be inherited from the base TimeseriesChart that was created in the Line migration. I will rebase this PR on top of that one.

@michael-s-molina michael-s-molina removed the v3.0 Label added by the release manager to track PRs to be included in the 3.0 branch label Jun 26, 2023
@EugeneTorap
Copy link
Contributor

Hi @michael-s-molina! When do we plan to merge it?

@michael-s-molina
Copy link
Member Author

Hi @michael-s-molina! When do we plan to merge it?

4.0 given that the window for breaking changes is now closed.

@rusackas rusackas added the v4.0 Label added by the release manager to track PRs to be included in the 4.0 branch label Jul 23, 2023
@michael-s-molina
Copy link
Member Author

Closing this PR in favor of #25952 which makes it possible to migrate the chart without introducing a breaking change.

@michael-s-molina michael-s-molina removed the hold! On hold label Jan 16, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
risk:breaking-change Issues or PRs that will introduce breaking changes size/XXL v4.0 Label added by the release manager to track PRs to be included in the 4.0 branch
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants