Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/javascript/361.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/angularjs/25.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Javascript 角度jQCloud:根据字数调整字数_Javascript_Angularjs - Fatal编程技术网

Javascript 角度jQCloud:根据字数调整字数

Javascript 角度jQCloud:根据字数调整字数,javascript,angularjs,Javascript,Angularjs,使用用于: 我希望能够改变字号的字数的基础上,因为它是一个不同的词集的基础上,用户是在哪一页。单词集是作为angularjs promise的一部分创建的 我尝试了font size=“project.wordSize”并向它传递一个字符串{from:0.06,to:0.04}(根据大小使用不同的数字),但是,这不起作用。我假设,因为asproject.wordSize是承诺的一部分,在创建元素时它不可用,因此fontSize将等于null。我最后用以下代码修改了jqcloud.js源代码:

使用用于:


我希望能够改变字号的字数的基础上,因为它是一个不同的词集的基础上,用户是在哪一页。单词集是作为angularjs promise的一部分创建的


我尝试了
font size=“project.wordSize”
并向它传递一个字符串
{from:0.06,to:0.04}
(根据大小使用不同的数字),但是,这不起作用。我假设,因为as
project.wordSize
是承诺的一部分,在创建元素时它不可用,因此fontSize将等于null。

我最后用以下代码修改了jqcloud.js源代码:

drawWordCloud: function() {
  ...

  // Generate font sizes
  this.data.sizes = [];

  if (this.sizeGenerator) {

     // apply a multipler depending on the number of words
     var multiplier = 1.1;

     if(this.word_array.length < 5){
         multiplier = 2.1;
     }
     else if(this.word_array.length < 10){
        multiplier = 2;
     }
     else if(this.word_array.length < 20){
         multiplier = 1.2;
     }
  }

   for (i=0; i<this.options.steps; i++) {
     this.data.sizes.push((this.sizeGenerator(this.options.width, this.options.height, i+1)).replace('px', '') * multiplier + 'px');
   }

  ...
}
drawWordCloud:function(){
...
//生成字体大小
this.data.size=[];
如果(此.sizeGenerator){
//根据字数应用乘法器
var乘数=1.1;
if(this.word_array.length<5){
乘数=2.1;
}
else if(this.word_array.length<10){
乘数=2;
}
else if(this.word_array.length<20){
乘数=1.2;
}
}
对于(i=0;i
drawWordCloud: function() {
  ...

  // Generate font sizes
  this.data.sizes = [];

  if (this.sizeGenerator) {

     // apply a multipler depending on the number of words
     var multiplier = 1.1;

     if(this.word_array.length < 5){
         multiplier = 2.1;
     }
     else if(this.word_array.length < 10){
        multiplier = 2;
     }
     else if(this.word_array.length < 20){
         multiplier = 1.2;
     }
  }

   for (i=0; i<this.options.steps; i++) {
     this.data.sizes.push((this.sizeGenerator(this.options.width, this.options.height, i+1)).replace('px', '') * multiplier + 'px');
   }

  ...
}