-
Notifications
You must be signed in to change notification settings - Fork 13.9k
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: Adds Line chart migration logic #23973
Conversation
3e8840d
to
bcfb878
Compare
bcfb878
to
7791b92
Compare
7791b92
to
3480a33
Compare
3480a33
to
808c8ac
Compare
1df9eb4
to
0200172
Compare
e39fa2c
to
f09881a
Compare
superset/cli/viz_migrations.py
Outdated
@@ -29,6 +29,7 @@ class VizType(str, Enum): | |||
AREA = "area" | |||
PIVOT_TABLE = "pivot_table" | |||
SUNBURST = "sunburst" | |||
LINE = "line" |
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.
ABC?
has_x_axis_control = True | ||
|
||
def _pre_action(self) -> None: | ||
self.data["contributionMode"] = "row" if self.data.get("contribution") else None |
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.
Is this (and other attributes) required? Generally if not I think it's cleaner/safer to leave these undefined and fallback to the default.
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.
These rules were added to keep visual consistency between the previous and new versions.
|
||
def _pre_action(self) -> None: | ||
self.data["contributionMode"] = "row" if self.data.get("contribution") else None | ||
self.data["zoomable"] = False if self.data.get("show_brush") == "no" else True |
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.
self.data["zoomable"] = False if self.data.get("show_brush") == "no" else True | |
self.data["zoomable"] = self.data.get("show_brush") != "no" |
): | ||
self.data["bottom_margin"] = 30 | ||
|
||
if (rolling_type := self.data.get("rolling_type")) and rolling_type != "None": |
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.
Any reason rolling_type
is "None"
as opposed to None
?
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.
Many of these safe checks were added as a result of trying to run this migration using our production database which contained really old charts and inconsistent values.
|
||
if time_compare := self.data.get("time_compare"): | ||
self.data["time_compare"] = [ | ||
value + " ago" for value in as_list(time_compare) if value |
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.
Are there causes when value
is falsy?
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.
Same as above.
SUMMARY
This PR adds the Line chart migration logic (NVD3 ➡️ ECharts). Users can execute this migration using the migrate_viz CLI command and disable the legacy version with the VIZ_TYPE_DENYLIST configuration.
@sadpandajoe @jinghua-qa
BEFORE/AFTER SCREENSHOTS OR ANIMATED GIF
TESTING INSTRUCTIONS
1 - Upgrade a Line chart using the CLI command
2 - Check the new chart
3 - Downgrade a Line chart using the CLI command
4 - Check the legacy chart
ADDITIONAL INFORMATION