2016-10-03 38 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; 
 
    }

回答