简体   繁体   English

未捕获的语法错误:Chrome控制台SCRIPT1003中的意外标识符:IE中应为':'

[英]Uncaught syntaxerror: unexpected identifier in chrome console SCRIPT1003: expected ':' in IE

I am unable to show data provided from database in the google chart. 我无法在Google图表中显示从数据库提供的数据。 I am constantly getting the same error in chrome console. 我在chrome控制台中不断收到相同的错误。

Uncaught syntaxerror: unexpected identifier in chrome console SCRIPT1003: expected ':' in IE 未捕获的语法错误:Chrome控制台SCRIPT1003中的意外标识符:IE中应为':'

@model IEnumerable @model IEnumerable

google.charts.load('current', {packages: ['corechart', 'bar']});
google.charts.setOnLoadCallback(drawDualY);

function drawDualY() {
var data = new google.visualization.DataTable();
data.addColumn('string', 'Topic');
data.addColumn('string', 'Test');
data.addColumn('string', 'Retest');


@foreach (var item in Model)
{
@: data.addRows[{@item.TTopic},@item.TScoreTest,@item.TScoreRetest],
}

var options = {
chart: {
title: 'Employee Score Card',

},
series: {
0: {axis: ''},
1: {axis: ''}
},
axes: {
y: {
MotivationLevel: {label: 'Test Score'},
EnergyLevel: {label: 'Restest Score'}
}
},
hAxis: {
title: 'Test Topic',
format: '',
viewWindow: {
min: [9, 30, 0],
max: [17, 30, 0]
}
},
vAxis: {
title: 'Employee Score'
}
};

var materialChart = new google.charts.Bar(document.getElementById('chart_div'));
materialChart.draw(data, options);
}

The cause of this type of error can often be a misplaced comma in an object or array definition:ie. 此类错误的原因通常是对象或数组定义中逗号放置错误:

 var obj = {
   id: 23,
   name: "test",  <--
}

If it appears at a random line, maybe it's part of an object defintion you are creating dynamically. 如果它出现在随机线上,则可能是您动态创建的对象定义的一部分。

var options = { chart: { title: 'Employee Score Card', var options = {chart:{title: 'Employee Score Card',

You have an extra comma after 'Employee Score Card', 在“员工记分卡”之后,您还有一个逗号,

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM