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];
}
发布者:admin,转转请注明出处:http://www.yc00.com/questions/1745171576a4614958.html
评论列表(0条)