当alert("inside function: " +data);
在下面注释掉时,数据线不会显示在图上,但是当其未注释并且用户关闭警报时,图形会填充数据集。
在调用时间为$.plot
时,数据是否能够完全加载?flot图不显示数据,数据未完全加载?
[01:05:21.158] TypeError: myfile is undefined @ http://localhost:8080/App/js/App.js:7
脚本..
$(function() {
var plotarea = $("#placeholder"),
myfile = Script_JSON.getData("myfile"),
anotherfile = Script_JSON.getData("anotherfile");
$.plot(plotarea, [myfile.data, anotherfile.data]);
});
var Script_JSON = {
getData: function(component) {
var data;
$.getJSON("data/" + component + ".json", function(json) {
data=json;
});
//alert("inside function: " +data);
return data;
}
};