[英]Which differences in javascript object creation syntax have I not understood? IE8 vs Chrome
I am working with Highcharts, to display data graphically. 我正在使用Highcharts,以图形方式显示数据。 I've chosen this library specifically because of its compatibility with both IE8 and a newer version of Google Chrome, as it renders the charts in VML or SVG, depending on supportability.
我之所以选择该库,是因为它既与IE8兼容,又与Google Chrome的较新版本兼容,因为它根据支持性以VML或SVG形式显示图表。
HighCharts can be created by defining a properties-object, which is passed as a parameter. 可以通过定义作为参数传递的属性对象来创建HighCharts。 This is working like a charm in Chrome, but I'm having trouble in IE8 (is there an echo in here?)
这在Chrome中就像是一种魅力,但是在IE8中却遇到了麻烦(这里有回声吗?)
I suspect that the error is different syntax support for the two browsers, when defining an object in javascript. 我怀疑在javascript中定义对象时,错误是两种浏览器的语法支持不同。 The two questions below are the closest thing I have come to finding any info, but they didn't address my actual problem.
以下两个问题是我找到任何信息最接近的问题,但它们并没有解决我的实际问题。
What are the most likely causes of Javascript errors in IE8? IE8中Javascript错误的最可能原因是什么?
IE8 errors when defining a Javascript object? 定义Javascript对象时IE8错误?
My code for defining the properties object is stated below. 我定义属性对象的代码如下。 My error is always in the first line of this snippet.
我的错误始终在此代码段的第一行中。 However, I cannot find any errors in that line, so I think it has to be somewhere else, and only refer to it's "root".
但是,我在该行中找不到任何错误,因此我认为它必须在其他位置,并且仅指代它的“根”。
entry
is an object with a few parameters, to populate the chart with titles and similar: entry
是具有一些参数的对象,用于用标题和类似内容填充图表:
var chartOptions = {
chart: {
renderTo: "piecontainer"+index,
plotBackgroundColor: null,
plotBorderWidth: 0,
plotShadow: false
},
title: {
text: entry.title + '<br/><br/>' + entry.path + '<br/><br/>Total: ' + Object.keys(entry.testMap).length,
align: 'center',
verticalAlign: 'middle',
y: 50
},
tooltip: {
pointFormat: '{series.name}: <b> {point.y} ({point.percentage:.1f}%)</b>'
},
legend: {
width: 415,
enabled: true,
useHTML: true,
labelFormatter: function() {
return '<span>' + this.name + ': ' + this.y + '<t/></span>';
},
itemDistance: 20
},
credits: {
enabled: false
},
plotOptions: {
pie: {
size: '100%',
animation: false,
dataLabels: {
enabled: false
},
showInLegend: true,
startAngle: -90,
endAngle: 90,
center: ['50%', '75%']
}
},
series: [{
type: 'pie',
name: 'Test Cases',
innerSize: '50%',
data: [
['Passed', 1],
['Not Completed', 1],
['Failed', 1],
['No Run', 1],
['N/A', 1],
['Blocked', 1],
['Incorrect Database Value', 1]
]
}]
};
EDIT: As I can tell by this post: Strange behavior Highcharts pie chart in document mode IE8 , the main structure of my object notation is correct. 编辑:正如我可以通过这篇文章告诉的: 在文档模式IE8中 , 奇怪的行为Highcharts饼图 ,我的对象表示法的主要结构是正确的。 There has to be a single line or two in the middle, that are causing the problems.
中间必须有一两行引起问题。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.