peter-stuart-turner commented on a change in pull request #4871: Add 
spider/radar chart 
URL: 
https://github.com/apache/incubator-superset/pull/4871#discussion_r185430056
 
 

 ##########
 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:
   To make room for later functionality of having multiple 'scenarios' pitted 
against one another:
   
        var data = [
                                          [//iPhone
                                                {axis:"Battery 
Life",value:0.22},
                                                {axis:"Brand",value:0.28},      
        
                                          ],[//Samsung
                                                {axis:"Battery 
Life",value:0.27},
                                                {axis:"Brand",value:0.16},
                                          ],[//Nokia Smartphone
                                                {axis:"Battery 
Life",value:0.26},
                                                {axis:"Brand",value:0.10},
                                          ]
                                        ];
   Example over here: 
   https://www.visualcinnamon.com/2015/10/different-look-d3-radar-chart.html 

----------------------------------------------------------------
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:
us...@infra.apache.org


With regards,
Apache Git Services

Reply via email to