docs/js/controllers/app.js
function resizeWordsCloud() {
         $timeout(function() {
            var element = document.getElementById('wordsCloud');
            var height = $window.innerHeight * 0.75;
            element.style.height = height + 'px';
            var width = element.getBoundingClientRect().width;
            var maxCount = originWords[0].count;
            var minCount = originWords[originWords.length - 1].count;
            var maxWordSize = width * 0.15;
            var minWordSize = maxWordSize / 5;
            var spread = maxCount - minCount;
            if (spread <= 0) spread = 1;
            var step = (maxWordSize - minWordSize) / spread;
            self.words = originWords.map(function(word) {
               return {
                  text: word.text,
                  size: Math.round(maxWordSize - ((maxCount - word.count) * step)),
                  color: self.customColor,
                  tooltipText: word.text + ' tooltip'
               };
            });
            self.width = width;
            self.height = height;
            self.padding = self.editPadding;
            self.rotate = self.editRotate;
         });
      }
function resizeWordsCloud() {
         $timeout(function() {
            var element = document.getElementById('wordsCloud');
            var height = $window.innerHeight * 0.75;
            element.style.height = height + 'px';
            var width = element.getBoundingClientRect().width;
            var maxCount = originWords[0].count;
            var minCount = originWords[originWords.length - 1].count;
            var maxWordSize = width * 0.15;
            var minWordSize = maxWordSize / 5;
            var spread = maxCount - minCount;
            if (spread <= 0) spread = 1;
            var step = (maxWordSize - minWordSize) / spread;
            self.words = originWords.map(function(word) {
               return {
                  text: word.text,
                  size: Math.round(maxWordSize - ((maxCount - word.count) * step)),
                  color: self.customColor,
                  tooltipText: word.text + ' tooltip'
               };
            });
            self.width = width;
            self.height = height;
            self.padding = self.editPadding;
            self.rotate = self.editRotate;
         });
      }
function resizeWordsCloud ( ) { $timeout ( function ( ) { var element = document . getElementById ( 'wordsCloud' ) ; var height = $window . innerHeight * 0.75 ; element . style . height = height + 'px' ; var width = element . getBoundingClientRect ( ) . width ; var maxCount = originWords [ 0 ] . count ; var minCount = originWords [ originWords . length - 1 ] . count ; var maxWordSize = width * 0.15 ; var minWordSize = maxWordSize / 5 ; var spread = maxCount - minCount ; if ( spread <= 0 ) spread = 1 ; var step = ( maxWordSize - minWordSize ) / spread ; self . words = originWords . map ( function ( word ) { return { text : word . text , size : Math . round ( maxWordSize - ( ( maxCount - word . count ) * step ) ) , color : self . customColor , tooltipText : word . text + ' tooltip' } ; } ) ; self . width = width ; self . height = height ; self . padding = self . editPadding ; self . rotate = self . editRotate ; } ) ; }
adjust words size base on width
adjust words size base on width