Warning: file_get_contents(/data/phpspider/zhask/data//catemap/4/regex/17.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
Highcharts插件最近被破坏了--”;this.init不是一个函数;_Highcharts - Fatal编程技术网

Highcharts插件最近被破坏了--”;this.init不是一个函数;

Highcharts插件最近被破坏了--”;this.init不是一个函数;,highcharts,Highcharts,我有一个创建Highcharts图表对象的js文件。我添加了一个插件来改变标签对比度。插件如下: /** * Override getContrast function; make threshold for showing white text very high */ (function(H) { H.Renderer.prototype.getContrast = function(rgba) { rgba = H.Color(rgba).rgba; ret

我有一个创建Highcharts图表对象的js文件。我添加了一个插件来改变标签对比度。插件如下:

/**
* Override getContrast function; make threshold for showing white text very high
*/
(function(H) {
    H.Renderer.prototype.getContrast = function(rgba) {
      rgba = H.Color(rgba).rgba;
      return rgba[0] + rgba[1] + rgba[2] > 210 ? '#000000' : '#FFFFFF';
    };
}(Highcharts));
几个月来,它一直运转良好。我最近注意到图表不再呈现,我的错误控制台显示:uncaughttypeerror:this.init不是一个函数 在Object.e[as Color](highcharts.src.js:2839)

我能够将源代码追溯到Highcharts.src.js文件的这一部分:

        /**
         * Handle color operations. Some object methods are chainable.
         *
         * @param {Highcharts.ColorType} input
         *        The input color in either rbga or hex format
         */
        function Color(input) {
            // Collection of parsers. This can be extended from the outside by pushing
            // parsers to Highcharts.Color.prototype.parsers.
            this.parsers = [{
                    // RGBA color
                    // eslint-disable-next-line max-len
                    regex: /rgba\(\s*([0-9]{1,3})\s*,\s*([0-9]{1,3})\s*,\s*([0-9]{1,3})\s*,\s*([0-9]?(?:\.[0-9]+)?)\s*\)/,
                    parse: function (result) {
                        return [
                            pInt(result[1]),
                            pInt(result[2]),
                            pInt(result[3]),
                            parseFloat(result[4], 10)
                        ];
                    }
                }, {
                    // RGB color
                    regex: /rgb\(\s*([0-9]{1,3})\s*,\s*([0-9]{1,3})\s*,\s*([0-9]{1,3})\s*\)/,
                    parse: function (result) {
                        return [pInt(result[1]), pInt(result[2]), pInt(result[3]), 1];
                    }
                }];
            this.rgba = [];
            this.init(input);  //<!--ERROR RIGHT HERE
        }
/**
*处理颜色操作。有些对象方法是可链接的。
*
*@param{Highcharts.ColorType}输入
*rbga或十六进制格式的输入颜色
*/
功能颜色(输入){
//解析器的集合。可以通过按
//分析器到Highcharts.Color.prototype.parsers。
此参数为0.parsers=[{
//RGBA颜色
//eslint禁用下一行最大长度
正则表达式:/rgba\(\s*([0-9]{1,3})\s*,\s*([0-9]{1,3})\s*,\s*([0-9]{1,3})\s*,\s*([0-9]+)\s*)/,
解析:函数(结果){
返回[
品脱(结果[1]),
品脱(结果[2]),
品脱(结果[3]),
parseFloat(结果[4],10)
];
}
}, {
//RGB颜色
正则表达式:/rgb\(\s*([0-9]{1,3})\s*,\s*([0-9]{1,3})\s*,\s*([0-9]{1,3})\s*)/,
解析:函数(结果){
返回[pInt(结果[1])、pInt(结果[2])、pInt(结果[3])、1];
}
}];
this.rgba=[];

this.init(input);//自v8.0.1以来,Highcharts.Color必须与新关键字关联

以前

            stops: [
                [0, Highcharts.getOptions().colors[0]],
                [1, Highcharts.Color(Highcharts.getOptions().colors[0]).setOpacity(0).get('rgba')]
            ]
从v8.0.1开始

            stops: [
                [0, Highcharts.getOptions().colors[0]],
                [1, new Highcharts.Color(Highcharts.getOptions().colors[0]).setOpacity(0).get('rgba')]
            ]

我已经看到highcharts在做一些事情。如果您还没有升级库,请尝试升级。您可以在一些在线编辑器上复制此问题,我可以调试它吗?或者您可以直接在highcharts Github问题频道上报告此问题,核心开发人员将在该频道上答复您。谢谢!我将尝试此方法,并在有效的情况下将您的答案标记为正确。与此同时,我对它投了更高的票。