changes added (#13431)
diff --git a/superset-frontend/src/explore/components/controls/VizTypeControl.jsx b/superset-frontend/src/explore/components/controls/VizTypeControl.jsx
index 085fdd8..df3bfd3 100644
--- a/superset-frontend/src/explore/components/controls/VizTypeControl.jsx
+++ b/superset-frontend/src/explore/components/controls/VizTypeControl.jsx
@@ -85,7 +85,7 @@
'partition',
'event_flow',
'deck_path',
- 'directed_force',
+ 'graph_chart',
'world_map',
'paired_ttest',
'para',
diff --git a/superset/examples/energy.py b/superset/examples/energy.py
index cd844a5..b101905 100644
--- a/superset/examples/energy.py
+++ b/superset/examples/energy.py
@@ -94,23 +94,21 @@
slc = Slice(
slice_name="Energy Force Layout",
- viz_type="directed_force",
+ viz_type="graph_chart",
datasource_type="table",
datasource_id=tbl.id,
params=textwrap.dedent(
"""\
{
- "charge": "-500",
- "collapsed_fieldsets": "",
- "groupby": [
- "source",
- "target"
- ],
- "link_length": "200",
+ "source": "source",
+ "target": "target",
+ "edgeLength": 400,
+ "repulsion": 1000,
+ "layout": "force",
"metric": "sum__value",
"row_limit": "5000",
"slice_name": "Force",
- "viz_type": "directed_force"
+ "viz_type": "graph_chart"
}
"""
),
diff --git a/superset/viz.py b/superset/viz.py
index 1183418..b00a945 100644
--- a/superset/viz.py
+++ b/superset/viz.py
@@ -1898,31 +1898,6 @@
return recs
-class DirectedForceViz(BaseViz):
-
- """An animated directed force layout graph visualization"""
-
- viz_type = "directed_force"
- verbose_name = _("Directed Force Layout")
- credits = 'd3noob @<a href="http://bl.ocks.org/d3noob/5141278">bl.ocks.org</a>'
- is_timeseries = False
-
- def query_obj(self) -> QueryObjectDict:
- qry = super().query_obj()
- if len(self.form_data["groupby"]) != 2:
- raise QueryObjectValidationError(_("Pick exactly 2 columns to 'Group By'"))
- qry["metrics"] = [self.form_data["metric"]]
- if self.form_data.get("sort_by_metric", False):
- qry["orderby"] = [(qry["metrics"][0], False)]
- return qry
-
- def get_data(self, df: pd.DataFrame) -> VizData:
- if df.empty:
- return None
- df.columns = ["source", "target", "value"]
- return df.to_dict(orient="records")
-
-
class ChordViz(BaseViz):
"""A Chord diagram"""
diff --git a/tests/fixtures/energy_dashboard.py b/tests/fixtures/energy_dashboard.py
index 68d142f..42fb46e 100644
--- a/tests/fixtures/energy_dashboard.py
+++ b/tests/fixtures/energy_dashboard.py
@@ -141,16 +141,17 @@
},
{
"slice_title": "Energy Force Layout",
- "viz_type": "directed_force",
+ "viz_type": "graph_chart",
"params": {
- "charge": "-500",
- "collapsed_fieldsets": "",
- "groupby": ["source", "target"],
- "link_length": "200",
+ "source": "source",
+ "target": "target",
+ "edgeLength": 400,
+ "repulsion": 1000,
+ "layout": "force",
"metric": "sum__value",
"row_limit": "5000",
"slice_name": "Force",
- "viz_type": "directed_force",
+ "viz_type": "graph_chart",
},
},
{