尝试在 jenkins 插件中使用 chartist.js。我已经使用 cdn - 常规导入(和 css)导入了库。
但是我在浏览器调试中得到“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;
}