【发布时间】:2014-01-28 18:30:29
【问题描述】:
我已经检查了代码中的逗号、分号,一切看起来都很好。在 Firefox 和 Chrome 中它工作正常,但在 IE8 中它提示我在 Highcharts.js 中的 Invalid Argument line 80 指向:
if(!C.namespaces.hcv)C.namespaces.add("hcv","urn:schemas-microsoft-com:vml")
这是我的代码
var chart = new Highcharts.Chart({
chart: {
renderTo: container[0],
type: 'column',
style: {
fontFamily: '"Arial", "Helvetica", "sans-serif"',
fontSize: '12px',
fontWeight: 'bold'
},
spacingLeft: 0
},
credits: {
enabled: false
},
title: null,
yAxis: {
title: null,
lineWidth: 2,
lineColor: '#505050',
gridLineWidth: 0,
labels: {
step: 1,
y: 0,
style: {
fontFamily: '"Arial", "Helvetica", "sans-serif"',
fontSize: '11px',
fontWeight: 'normal'
}
},
min: 0,
minRange:0.1
},
xAxis: {
categories:cat,
labels: {
style: {
fontFamily: '"Arial", "Helvetica", "sans-serif"',
fontSize: '11px',
fontWeight: 'normal',
width: '90px'
}
},
tickWidth: 0
},
plotOptions: {
column: {
dataLabels: {
enabled: true,
formatter: function() {
var percent =0;
var catName =this.x;
if(catName.indexOf('TAM')>=0){
percent = this.y ;
if (percent <= 50) {
return '<span style="color: #7b4000">' + percent + '</span>';
} else {
return '<span style="color: #3a5305">' + percent + '</span>';
}
}
else {
percent =Math.round( this.point.shareValue * 100)/100;
if (percent <= 50) {
return '<span style="color: #7b4000">' + percent + '%</span>';
} else {
return '<span style="color: #3a5305">' + percent + '%</span>';
}
}
},
style: {
fontFamily: '"Arial", "Helvetica", "sans-serif"',
fontWeight: 'bold'
},
zIndex: 11,
useHTML: true
},
borderWidth: 0,
shadow: false
}
},
series: [{
data: data
}],
legend: {
enabled: false
},
tooltip: {
enabled: false
}
}, function(chart) {
for (var i = 0; i < 5; ++i) {
chart.renderer.path(['M', 23, 160.5 - 28 * i, 'L', 34, 160.5 - 28 * i]).attr({
'stroke-width': 1,
stroke: 'white',
'stroke-opacity': 0.7,
zIndex: 10
}).add();
if ($.browser.msie && parseInt($.browser.version <= 8) && !CHART_CUT_LINE_FOR_IE) {
continue;
}
chart.renderer.path(['M', 30, 160.5 - 28 * i, 'L', 300, 160.5 - 28 * i]).attr({
'stroke-width': 1,
stroke: 'white',
'stroke-opacity': 0.3,
zIndex: 10
}).add();
}
});
有什么想法吗?
谢谢。
【问题讨论】:
-
您没有提供完整的代码。使用您的图表代码,设置我的
categories和data,并包括 jquery 1.8.3($.browser.msie从 1.9.0 开始不可用)我得到了没有错误的图表。最好在jsFiddle中准备例子。 -
请提供完整代码
标签: javascript highcharts