ajaxPost(action, "getData", params, function(data) {
var response = toObject(data).response;
var chartData = new google.visualization.DataTable();
var array = [];
for(var i = 0; i < response.occData.length; i++){
var data = [];
for(var j = 1; j < 32; j++){
array.push(response.occData[i].dayList[j]);
}
chartData.addColumn("string",array);
}
new google.visualization.LineChart(document.getElementById('chart_div')).
draw(chartData, {vAxes:[
{title: 'Title 1', titleTextStyle: {color: '#FF0000'}}, // Left axis
{title: 'Title 2', titleTextStyle: {color: '#FF0000'}} // Right axis
],series:[
{targetAxisIndex:1},
{targetAxisIndex:0}
],curveType: "function",width: 700, height: 240});
$("#" + "chart_div").fadeIn(2000);
});
上記のコードを使用して折れ線グラフを描画しています! しかし、グラフは描かれておらず、データもありません。私は ajax 応答を使用しており、データも渡されます。firebug エラーはなく、応答は次のとおりです。私を助けてください!
{"response": {"status":true , "occData":[{"dayList":{1:9.0,2:6.0,3:4.0,4:4.0,5:3.0,6:3.0,7:3.0,8:3.0,9:3.0,10:7.0,11:7.0,12:6.0,13:4.0,14:4.0,15:4.0,16:4.0,17:3.0,18:3.0,19:4.0,20:6.0,21:7.0,22:6.0,23:7.0,24:6.0,25:5.0,26:8.0,27:9.0,28:7.0,29:8.0,30:8.0,31:5.0},"hotelCode":"BBH","month":"May","monthStartDate":"May-2012","orderSeq":11,"reservationRowType":"REV_OCC_PER","total":5.4,"year":"2012"},{"dayList":{1:52368.0,2:87239.0,3:126683.0,4:126683.0,5:147851.0,6:147851.0,7:147851.0,8:147851.0,9:147851.0,10:72566.0,11:66706.0,12:87915.0,13:110090.0,14:110090.0,15:110090.0,16:110090.0,17:147851.0,18:147851.0,19:126729.0,20:104461.0,21:95655.0,22:104562.0,23:88476.0,24:100402.0,25:111558.0,26:65367.0,27:61136.0,28:75780.0,29:70367.0,30:70367.0,31:111558.0},"hotelCode":"BBH","month":"May","monthStartDate":"May-2012","orderSeq":13,"reservationRowType":"ARR","total":96370.0,"year":"2012"}]}}