Javascript 错误类型错误:无法设置属性';继续';未定义的
我正在尝试使用Highcharts Javascript图表引擎绘制一些图表,我已经全部设置好了,它在我的本地开发环境中运行良好,但是当我将其部署到Gitlab并访问它时,它给了我以下错误:Javascript 错误类型错误:无法设置属性';继续';未定义的,javascript,highcharts,gitlab,Javascript,Highcharts,Gitlab,我正在尝试使用Highcharts Javascript图表引擎绘制一些图表,我已经全部设置好了,它在我的本地开发环境中运行良好,但是当我将其部署到Gitlab并访问它时,它给了我以下错误: ERROR TypeError: Cannot set property 'proceed' of undefined at t.<computed> (main-es2015.7538dcc357c548058d75.js:1) at Object.<anonymous&
ERROR TypeError: Cannot set property 'proceed' of undefined
at t.<computed> (main-es2015.7538dcc357c548058d75.js:1)
at Object.<anonymous> (main-es2015.7538dcc357c548058d75.js:1)
at Object.t.<computed> [as arc] (main-es2015.7538dcc357c548058d75.js:1)
at A.getPlotBandPath (main-es2015.7538dcc357c548058d75.js:1)
at s.renderBackground (main-es2015.7538dcc357c548058d75.js:1)
at s.render (main-es2015.7538dcc357c548058d75.js:1)
at main-es2015.7538dcc357c548058d75.js:1
at Array.forEach (<anonymous>)
at t.each (main-es2015.7538dcc357c548058d75.js:1)
at t.Chart.<anonymous> (main-es2015.7538dcc357c548058d75.js:1)
下面是创建图表的步骤:
this.skillChart = new Chart(<any>{
chart: {
type: 'solidgauge',
spacing: [0, 0, 0, 0],
backgroundColor: 'transparent',
borderColor: 'transparent'
},
title: null,
pane: {
center: ['50%', '80%'],
size: '130%',
startAngle: -90,
endAngle: 90,
background: this.seriesBackgrounds
},
credits: {
enabled: false
},
yAxis: {
min: 0,
max: this.maxScore,
gridLineWidth: 0,
lineWidth: 0,
minorGridLineWidth: 0,
minorTickWidth: 0,
tickWidth: 0,
labels: {
enabled: false
}
},
tooltip: {
borderWidth: 0,
followPointer: true,
pointFormat: '<span style="color:{point.color}">\u25CF</span> {point.name}: <b>{point.y}</b><br/>',
shared: true,
useHTML: true
},
series: [
{
animation: {
duration: 1500
},
dataLabels: {
enabled: false
},
data: this.seriesData
}
]
});
this.skillChart=新图表({
图表:{
类型:“solidgauge”,
间距:[0,0,0,0],
背景色:“透明”,
边框颜色:“透明”
},
标题:空,
窗格:{
中心:['50%,'80%,],
大小:“130%”,
startAngle:-90,
端角:90,
背景:本系列背景
},
学分:{
已启用:false
},
亚克斯:{
分:0,,
马克斯:这个,马克斯考尔,
网格线宽:0,
线宽:0,
minorGridLineWidth:0,
minorTickWidth:0,
宽度:0,
标签:{
已启用:false
}
},
工具提示:{
边框宽度:0,
followPointer:true,
pointFormat:'\u25CF{point.name}:{point.y}
',
分享:是的,
useHTML:true
},
系列:[
{
动画:{
持续时间:1500
},
数据标签:{
已启用:false
},
数据:this.seriesData
}
]
});
当我运行平台时,我希望看到一个图表显示一个半圆形条,其中提交数为10,顶部为10,这正是我在本地环境中运行平台时得到的结果
但是,当我从部署的Gitlab平台运行时,我得到了组件,但图表没有画半圆
我没有足够的声誉来发布这些图片,否则,人们会更容易理解我的意思。我也遇到了同样的问题。我的观察:我正在使用Highcharts JS v6.1.4(2018-09-25),通过角度Highcharts与NPM一起安装 调试代码时,代码会在与highcharts.src.js的此片段相关的精简代码中中断:
/**
* Wrap a method with extended functionality, preserving the original function.
*
* @function Highcharts.wrap
*
* @param {*} obj
* The context object that the method belongs to. In real cases, this is
* often a prototype.
*
* @param {string} method
* The name of the method to extend.
*
* @param {Function} func
* A wrapper function callback. This function is called with the same
* arguments as the original function, except that the original function
* is unshifted and passed as the first argument.
*/
H.wrap = function (obj, method, func) {
var proceed = obj[method];
obj[method] = function () {
var args = Array.prototype.slice.call(arguments),
outerArgs = arguments,
ctx = this,
ret;
ctx.proceed = function () {
proceed.apply(ctx, arguments.length ? arguments : outerArgs);
};
args.unshift(proceed);
ret = func.apply(this, args);
ctx.proceed = null;
return ret;
};
};
精简后的代码格式如下:
a.wrap = function(a, h, e) {
var m = a[h];
a[h] = function() {
var a = Array.prototype.slice.call(arguments)
, p = arguments
, u = this;
u.proceed = function() {
m.apply(u, arguments.length ? arguments : p)
}
;
a.unshift(m);
a = e.apply(this, a);
u.proceed = null;
return a
}
}
;
我已在2个环境中部署;在其中一种情况下,代码可以工作,但在另一种情况下则不行。在失败的一个例子中,我调试了并且当到达赋值时,u=this
变量未赋值,因此在下一行出现错误:u.procedue=function(){
在我的另一个环境中,这个
有窗口
作为值,它有一个继续
属性,然后一切正常
到目前为止,我还不明白为什么会发生这种情况
我希望这能有所帮助
编辑:升级angular highcharts
到8.0.3
版本和highcharts
到7.2.0
版本为我解决了这个问题:)你的构建过程是什么?stacktrace来自某个小型化的东西。我正在使用Gitlab CI作为构建过程不幸的是,这没有告诉我们什么配置?什么插件/步骤?再说一次,堆栈跟踪来自于缩小的代码,我假设你不会手工在一行上写几百甚至几千个字符。你能试着在像JSFIDLE这样的在线代码编辑器中重现这个问题吗?试着简化它,并使用生产代码中的示例数据结构。
a.wrap = function(a, h, e) {
var m = a[h];
a[h] = function() {
var a = Array.prototype.slice.call(arguments)
, p = arguments
, u = this;
u.proceed = function() {
m.apply(u, arguments.length ? arguments : p)
}
;
a.unshift(m);
a = e.apply(this, a);
u.proceed = null;
return a
}
}
;