feat: Adds Histogram chart migration logic (#28780)

This commit is contained in:
Michael S. Molina
2024-06-05 13:33:50 -03:00
committed by GitHub
parent dabb4e064f
commit df0b1cb8ed
11 changed files with 118 additions and 6 deletions

View File

@@ -280,3 +280,26 @@ class MigrateHeatmapChart(MigrateViz):
def _pre_action(self) -> None:
self.data["legend_type"] = "continuous"
class MigrateHistogramChart(MigrateViz):
source_viz_type = "histogram"
target_viz_type = "histogram_v2"
rename_keys = {
"x_axis_label": "x_axis_title",
"y_axis_label": "y_axis_title",
"normalized": "normalize",
}
remove_keys = {"all_columns_x", "link_length", "queryFields"}
def _pre_action(self) -> None:
all_columns_x = self.data.get("all_columns_x")
if all_columns_x and len(all_columns_x) > 0:
self.data["column"] = all_columns_x[0]
link_length = self.data.get("link_length")
self.data["bins"] = int(link_length) if link_length else 5
groupby = self.data.get("groupby")
if not groupby:
self.data["groupby"] = []