You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@superset.apache.org by GitBox <gi...@apache.org> on 2018/08/21 00:23:00 UTC

[GitHub] kristw commented on a change in pull request #5669: Repair and refactor Word Cloud

kristw commented on a change in pull request #5669: Repair and refactor Word Cloud
URL: https://github.com/apache/incubator-superset/pull/5669#discussion_r211446853
 
 

 ##########
 File path: superset/assets/src/visualizations/word_cloud.js
 ##########
 @@ -1,63 +1,98 @@
-/* eslint-disable  no-use-before-define */
 import d3 from 'd3';
+import PropTypes from 'prop-types';
 import cloudLayout from 'd3-cloud';
 import { getColorFromScheme } from '../modules/colors';
 
-function wordCloudChart(slice, payload) {
-  const chart = d3.select(slice.selector);
-  const data = payload.data;
-  const fd = slice.formData;
-  const range = [
-    fd.size_from,
-    fd.size_to,
-  ];
-  const rotation = fd.rotation;
-  let fRotation;
-  if (rotation === 'square') {
-    fRotation = () => Math.floor((Math.random() * 2) * 90);
-  } else if (rotation === 'flat') {
-    fRotation = () => 0;
-  } else {
-    fRotation = () => Math.floor(((Math.random() * 6) - 3) * 30);
-  }
-  const size = [slice.width(), slice.height()];
+const ROTATION = {
+  square: () => Math.floor((Math.random() * 2)) * 90,
+  flat: () => 0,
+  random: () => Math.floor(((Math.random() * 6) - 3)) * 30,
+};
+
+const propTypes = {
+  data: PropTypes.array,
 
 Review comment:
   sure. Thanks for catching.

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


With regards,
Apache Git Services

---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org