admin管理员组文章数量:1415460
I'm using highcharts for pie charts. There is a problem in the script in IE7 which says:
SCRIPT5007: Unable to get value of the property '0': object is null or undefined
highcharts.js, line 10 character 3841
Here is the line of code from the script:
if(typeof a[0]==="number")
this.x=a[0],this.y=a[1];
else if(d==="object"&&typeof a.length!=="number") {
if(u(this,a),this.options=a,a.dataLabels)c._hasPointLabels=!0
}
else if(typeof a[0]==="string")
this.name=a[0],this.y=a[1];
How do I resolve this issue?
I'm using highcharts for pie charts. There is a problem in the script in IE7 which says:
SCRIPT5007: Unable to get value of the property '0': object is null or undefined
highcharts.js, line 10 character 3841
Here is the line of code from the script:
if(typeof a[0]==="number")
this.x=a[0],this.y=a[1];
else if(d==="object"&&typeof a.length!=="number") {
if(u(this,a),this.options=a,a.dataLabels)c._hasPointLabels=!0
}
else if(typeof a[0]==="string")
this.name=a[0],this.y=a[1];
How do I resolve this issue?
Share Improve this question edited Aug 5, 2015 at 15:40 atw 5,86010 gold badges42 silver badges66 bronze badges asked Jan 4, 2013 at 5:57 Indira JeldiIndira Jeldi 411 silver badge6 bronze badges 1- Could you post the options that you are passing to Highcharts? – Pulkit Goyal Commented Jan 4, 2013 at 12:43
4 Answers
Reset to default 4This happened to me as well. After debugging, I eventually found the issue was because I had an extra ma ',' after the last element of my series data array.
An example of the issue can be found on this JSFiddle: http://jsfiddle/lewisdavidcole/Be43c/14/
The error only showed up in IE7 and IE8. It worked fine in IE9, Chrome and Firefox, which are more forgiving. To fix the issue, remove the extra ma on line 266 of the JSFIddle that looks like this:
}, //TO FIX, REMOVE THE EXTRA COMMA HERE WHICH CREATES PROBLEMS IN IE7 and IE8
The error happened because defining an array like
var myArray = [1,2,3,4,5,];
Creates an issue in IE7 and IE8, it should never end in a ma.
This is a mon misconfiguration, so we added a fix for it in Highcharts. See http://jsfiddle/highcharts/sw5rY/ .
series: [{
data: [29.9, 71.5, 106.4, 129.2,],
showInLegend: true
}]
Please alert(a[0]) and see does that array element has some value or not If not please used this condition before your code:-
if(a.length>0){
//your code
}
try this:
if(a.length>0){
if(typeof a[0]==="number")
this.x=a[0],this.y=a[1];
else if(d==="object"&&typeof a.length!=="number") {
if(u(this,a),this.options=a,a.dataLabels)c._hasPointLabels=!0
}
else if(typeof a[0]==="string")
this.name=a[0],this.y=a[1];
}
本文标签: javascriptUnable to get value of the property 39039 object is null or undefined in IE7Stack Overflow
版权声明:本文标题:javascript - Unable to get value of the property '0': object is null or undefined in IE7 - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1745171576a2646007.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论