john-bodley commented on code in PR #25952:
URL: https://github.com/apache/superset/pull/25952#discussion_r1396053265
##########
superset/migrations/shared/migrate_viz/processors.py:
##########
@@ -137,10 +103,22 @@ class MigrateSunburst(MigrateViz):
class TimeseriesChart(MigrateViz):
has_x_axis_control = True
+ rename_keys = {
+ "bottom_margin": "x_axis_title_margin",
+ "left_margin": "y_axis_title_margin",
+ "show_controls": "show_extra_controls",
+ "x_axis_label": "x_axis_title",
+ "x_axis_format": "x_axis_time_format",
+ "x_ticks_layout": "xAxisLabelRotation",
+ "y_axis_label": "y_axis_title",
+ "y_axis_showminmax": "truncateYAxis",
+ "y_log_scale": "logAxis",
+ }
+ remove_keys = {"contribution", "show_brush", "show_markers"}
def _pre_action(self) -> None:
self.data["contributionMode"] = "row" if self.data.get("contribution")
else None
- self.data["zoomable"] = self.data.get("show_brush") != "no"
+ self.data["zoomable"] = self.data.get("show_brush") == "yes"
Review Comment:
@michael-s-molina I see this is an update to the existing `TimeseriesChart`
migration where the `zoomable` used to be `True` if `show_brush` was `None`
whereas now it's `False`.
I'm not privy to knowing whether this logic (and that on lines 144–146) is
correct, but maybe it make more sense to have said logic in a separate PR.
Additionally is there anyway to proactively fix previously migrated charts
which were wrong? I gather the `x_ticks_layout` field could be remedied (as
it's persisted), but the `show_brush` was removed.
##########
superset/migrations/shared/migrate_viz/processors.py:
##########
@@ -189,3 +163,24 @@ def _pre_action(self) -> None:
elif line_interpolation == "step-after":
self.target_viz_type = "echarts_timeseries_step"
self.data["seriesType"] = "end"
+
+
+class MigrateAreaChart(TimeseriesChart):
+ source_viz_type = "area"
+ target_viz_type = "echarts_area"
+ stacked_map = {
+ "expand": "Expand",
+ "stack": "Stack",
+ "stream": "Stream",
+ }
+
+ def _pre_action(self) -> None:
+ super()._pre_action()
+
+ self.remove_keys.add("stacked_style")
+
+ self.data["stack"] = self.stacked_map.get(
Review Comment:
Should the `stack` key be `None` or undefined if the resulting key isn't in
`self.stacked_map`?
##########
superset/migrations/shared/migrate_viz/processors.py:
##########
@@ -137,10 +103,22 @@ class MigrateSunburst(MigrateViz):
class TimeseriesChart(MigrateViz):
has_x_axis_control = True
+ rename_keys = {
+ "bottom_margin": "x_axis_title_margin",
+ "left_margin": "y_axis_title_margin",
+ "show_controls": "show_extra_controls",
+ "x_axis_label": "x_axis_title",
+ "x_axis_format": "x_axis_time_format",
+ "x_ticks_layout": "xAxisLabelRotation",
+ "y_axis_label": "y_axis_title",
+ "y_axis_showminmax": "truncateYAxis",
+ "y_log_scale": "logAxis",
+ }
+ remove_keys = {"contribution", "show_brush", "show_markers"}
def _pre_action(self) -> None:
self.data["contributionMode"] = "row" if self.data.get("contribution")
else None
- self.data["zoomable"] = self.data.get("show_brush") != "no"
+ self.data["zoomable"] = self.data.get("show_brush") == "yes"
Review Comment:
@michael-s-molina I see this is an update to the existing `TimeseriesChart`
migration where the `zoomable` used to be `True` if `show_brush` was `None`
whereas now it's `False`.
I'm not privy to knowing whether this logic (and that on lines 144–146) is
correct, but maybe it make more sense to have said logic in a separate PR.
Additionally is there anyway to proactively fix previously migrated charts
which were wrong? I gather the `x_ticks_layout` field could be remedied (as
it's persisted), but the `show_brush` was removed.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]