0

尝试在 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;
  }

4

1 回答 1

0

通过使用 GitHub 存储库中最新版本的 chartist 更新 libary 文件夹来解决 - https://github.com/gionkunz/chartist-js/tree/develop

只需将“dist”文件夹复制到程序/Jenkins 插件中 npm 节点模块路径中的等效文件夹即可。

于 2016-10-04T11:57:25.900 回答