[英]Uncaught TypeError: Cannot read property 'timestamp' of undefined
I am new to hightcharts, I have an error which I found it on chrome console. 我不熟悉hightcharts,我在chrome控制台上发现了一个错误。 And the error is "Uncaught TypeError: Cannot read property 'timestamp' of undefined". 并且错误是“未捕获的TypeError:无法读取未定义的属性'timestamp'”。 Below is my code: 下面是我的代码:
Javascript.JS: Javascript.JS:
if(selVal==str2[j]) {
console.log("FOLDERNAME"+selVal);
str3.push(str2[j+1]);
}
var json = str3[0];
**//This is for highcharts where I am trying to load myjson that is present in "var json"**
for (var k = 0; k < json.length; k++) {
jsonArray.push({
name: json[k].map.timestamp,**//Getting error over here**
y:json[k].map.count
});
JSON FORMAT: JSON格式:
[{"map":{"timestamp":"2016-01-09 05:55:42.0","count":367}}]
Somebody please help me out in solving this. 有人请帮我解决这个问题。 I almost tried everything. 我几乎尝试了一切。
Try this 尝试这个
var json=[{"map":{"timestamp":"2016-01-09 05:55:42.0","count":367}}]; /***This is for highcharts where I am trying to load myjson that is present in "var json"**/ var jsonArray=[]; for (var k = 0; k < json.length; k++) { jsonArray.push({ name: json[k]["map"].timestamp, y:json[k]["map"].count }); } console.log(jsonArray)
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.