事前に感謝します。「Morris.js」を使用して棒グラフを作成するために ajax を使用して情報を持ってくると、プラグインでこの問題が発生します。コードは正常に動作します私の間違いは何ですか? コードは次のとおりです。
$(document).ready(function(){
var numberOfSeconds=30*1000; //the interval of refreshing the information of the calls per server
var x=getTheInfoAboutTheServers();
//The m_graph contains an information
//and build the graph itself later we update the data with the m_graph.setData() function
var m_graph= Morris.Bar({
element: 'my_chart',
data: x,
xkey: 'y',
ykeys: ['a'],
labels: ['Number of calls']
});
/**
* This Function get the number of calls per each server
* return a JSON object to the morris.js pluggin
*/
function getTheInfoAboutTheServers(){
var inf=null;
$.ajax({
async: false,
type: "POST",
url : $('#site_url').val()+"index.php/Login_controller/mw_iaa_rawGraphInfoClient",
dataType: "JSON",
success: function(data){
var dataArr=[];
for (key in data) {
if (!isNaN(key)) {
var obj = data[key];
var mySplitResult = obj['callserver'].split(".");
var calls=parseInt(obj['numOfCalls']);
dataArr.push({ y: String(mySplitResult[0]), a : calls});
}
}
inf=dataArr;
}
});
return inf;
}