Skip to content

Commit

Permalink
[getredash#1414] Change the word size calculation logic
Browse files Browse the repository at this point in the history
Some words do not show because the size of the word is too large.
  • Loading branch information
mohamagdy committed Mar 29, 2019
1 parent ec4b36b commit 2b1cb50
Show file tree
Hide file tree
Showing 3 changed files with 432 additions and 1,998 deletions.
7 changes: 5 additions & 2 deletions client/app/visualizations/word-cloud/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,11 @@ function wordCloudRenderer() {
}

const wordList = [];
each(wordsHash, (v, key) => {
wordList.push({ text: key, size: 10 + Math.pow(v, 2) });
const values = Object.keys(wordsHash).map(key => wordsHash[key]);
const maxValue = Math.max.apply(null, values);

each(wordsHash, (value, key) => {
wordList.push({ text: key, size: 120 * value / maxValue });
});

const fill = d3.scale.category20();
Expand Down
Loading

0 comments on commit 2b1cb50

Please sign in to comment.