hughhhh commented on a change in pull request #4871: Add spider/radar chart
URL:
https://github.com/apache/incubator-superset/pull/4871#discussion_r184785234
##########
File path: superset/viz.py
##########
@@ -2375,6 +2375,35 @@ def get_data(self, df):
return result
+class SpiderRadarViz(BaseViz):
+ """
+ A spider / radar chart.
+ """
+
+ viz_type = 'spider_radar'
+ verbose_name = _('Spider Radar Diagram')
+ credits = (
+ '<a href=https://www.visualcinnamon.com/>Nadieh Bremer, Data Viz
Expert</a>')
+ is_timeseries = False
+
+ def get_data(self, df):
+ fd = self.form_data
+
+ metrics = fd.get('metrics')
+ groupby = fd.get('groupby')
+
+ axisMap = groupby[0]
+ valueMap = metrics[0].get('label')
+
+ created_data = []
+ for index, row in df.iterrows():
+ created_data.append({'axis': row[axisMap], 'value': row[valueMap]})
+ data = [created_data]
Review comment:
Why are you casting `created_data` in another list?
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
[email protected]
With regards,
Apache Git Services