IE8のJavaScriptで「有効な2D配列ではありません」というエラーが発生します。このスクリプトは、Mozillaやその他の主要なブラウザで正常に機能しています。JavaScriptで2次元配列を使用しています。これがスクリプトです
<script type="text/javascript">
var new_arr = new Array();
new_arr[1] = 0;
new_arr[2] = 0;
new_arr[3] = 0;new_arr[4] = 0;new_arr[5] = 0;new_arr[6] = 0;new_arr[7] = 0;new_arr[8] = 0;new_arr[9] = 0;new_arr[10] = 0;new_arr[11] = 0;new_arr[12] = 0;new_arr[13] = 0;new_arr[14] = 0;new_arr[15] = 0;new_arr[16] = 0;new_arr[17] = 0;new_arr[18] = 0;new_arr[19] = 0;new_arr[20] = 0;new_arr[21] = 0;new_arr[22] = 0;new_arr[23] = 0;new_arr[24] = 0;new_arr[25] = 0;new_arr[26] = 0;new_arr[27] = 0;new_arr[28] = 0;new_arr[29] = 0;new_arr[30] = 0;new_arr[31] = 0;
//var val = new Array();
var val ='';
google.load("visualization", "1", {packages:["corechart"]});
google.setOnLoadCallback(drawChart);
function drawChart() {
var data = google.visualization.arrayToDataTable(
[
['Day', 'Answered Posts', 'Unanswered Posts'],
['1', 0,114],['2', 0,149],['3', 0,94],['4', 0,89],['5', 0,36],['6', 0,61],['7', 0,82],['8', 0,144],['9', 0,76],['10', 0,92],['11', 0,75],['12', 0,41],['13', 0,54],['14', 0,0],['15', 0,0],['16', 0,0],['17', 0,0],['18', 0,0],['19', 0,0],['20', 0,0],['21', 0,0],['22', 0,0],['23', 0,0],['24', 0,0],['25', 0,0],['26', 0,0],['27', 0,0],['28', 0,0],['29', 0,0],['30', 0,0],['31', 0,0], ]);
var options = {
width: 940,
height: 334,
min: 0,
max: 30,
fontSize:10,
chartArea:{width:800},
colors: Array('#33CC00','#FF0000'),
title: 'Posts In Current Month',
titleTextStyle: {color: 'grey', fontSize: 14},
hAxis: {maxAlternation: 1},
hAxis:{title: 'Day of Month', titleTextStyle: {color: '#000000'}},
tooltip:{textStyle: {color: '#000000'}, showColorCode: true},
legend:{position: 'bottom', textStyle: {color: 'blue', fontSize: 14}},
vAxis:{title: 'No of Posts', titleTextStyle: {color: '#000000'}},
vAxis: {
gridlines: {
color: '#000000',
count: 5
}
}
};
var chart = new google.visualization.AreaChart(document.getElementById('chart_div'));
chart.draw(data, options);
}