You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@superset.apache.org by ma...@apache.org on 2018/09/13 06:12:08 UTC

[incubator-superset] branch master updated: [bug fix] Fixed adhoc metric is not working for WordCloud (#5877)

This is an automated email from the ASF dual-hosted git repository.

maximebeauchemin pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-superset.git


The following commit(s) were added to refs/heads/master by this push:
     new 8569261  [bug fix] Fixed adhoc metric is not working for WordCloud (#5877)
8569261 is described below

commit 85692612d6f1438d8b19f51aefae92a240bc3cf3
Author: Conglei <sh...@gmail.com>
AuthorDate: Wed Sep 12 23:12:04 2018 -0700

    [bug fix] Fixed adhoc metric is not working for WordCloud (#5877)
    
    * fixed adhoc metric
    
    * change rotate default to flat
---
 superset/assets/src/explore/controls.jsx                  | 2 +-
 superset/assets/src/visualizations/wordcloud/WordCloud.js | 4 ++--
 2 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/superset/assets/src/explore/controls.jsx b/superset/assets/src/explore/controls.jsx
index 2a04c73..9700454 100644
--- a/superset/assets/src/explore/controls.jsx
+++ b/superset/assets/src/explore/controls.jsx
@@ -1313,7 +1313,7 @@ export const controls = {
     label: t('Rotation'),
     choices: formatSelectOptions(['random', 'flat', 'square']),
     renderTrigger: true,
-    default: 'square',
+    default: 'flat',
     description: t('Rotation to apply to words in the cloud'),
   },
 
diff --git a/superset/assets/src/visualizations/wordcloud/WordCloud.js b/superset/assets/src/visualizations/wordcloud/WordCloud.js
index 7458f7d..8766263 100644
--- a/superset/assets/src/visualizations/wordcloud/WordCloud.js
+++ b/superset/assets/src/visualizations/wordcloud/WordCloud.js
@@ -35,7 +35,7 @@ function wordCloud(element, props) {
 
   const chart = d3.select(element);
   const size = [width, height];
-  const rotationFn = ROTATION[rotation] || ROTATION.random;
+  const rotationFn = ROTATION[rotation] || ROTATION.flat;
 
   const scale = d3.scale.linear()
     .range(sizeRange)
@@ -88,7 +88,7 @@ function transform(data, formData) {
 
   const transformedData = data.map(datum => ({
     text: datum[series],
-    size: datum[metric],
+    size: datum[metric.label || metric],
   }));
 
   return transformedData;