2016-10-03 39 views
0

試圖在jenkins插件中使用chartist.js。 我用cdn導入了庫文件 - 常規導入(和css)。在詹金斯投擲使用圖表 - TypeError:自我未定義

但我在瀏覽器調試中得到「TypeError:self is undefined」而不是顯示圖表。我使用他們網站上最簡單的chartist.js例子。

這是函數的源代碼,創建錯誤:

/** 
 
    * Adds one or a space separated list of classes to the current element and ensures the classes are only existing once. 
 
    * 
 
    * @memberof Chartist.Svg 
 
    * @param {String} names A white space separated list of class names 
 
    * @return {Chartist.Svg} The wrapper of the current element 
 
    */ 
 
    function addClass(names) { 
 
    this._node.setAttribute('class', 
 
     this.classes(this._node) 
 
     .concat(names.trim().split(/\s+/)) 
 
     .filter(function(elem, pos, self) { 
 
      return self.indexOf(elem) === pos; 
 
     }).join(' ') 
 
    ); 
 

 
    return this; 
 
    }

回答