读取json时出错未捕获类型错误:Cannot read property 'output'的定义
Error while reading json Uncaught TypeError: Cannot read property 'output' of undefined
我正在尝试使用PUBNUB javascript SDK创建c3.js图表。问题是,当我尝试创建一个图表,它不会读取json数据,我得到错误Uncaught TypeError:无法读取属性'输出'的未定义。
完整的数据是(我正在通过python发送数据)
m = {
"devices": [
{
"Name": "bdev0",
"output": {
"IO_Operations": 0,
"Bytes_Read": 0,
"Bytes_Written": 0
}
},
{
"Name": "bdev1",
"output": {
"IO_Operations": 0,
"Bytes_Read": 0,
"Bytes_Written": 0
}
}
]
}
而JavaScript是
eon.chart({
pubnub : pubnub,
history : false,
channel : 'chanel',
flow : true,
generate : {
bindto : '#chart_1',
size: {
height: 180,
width: 500
},
data : {
x : 'x',
labels : true
},
axis : {
x : {
type : 'timeseries',
tick : {
format : '%H:%M:%S'
},
zoom: {
enabled: true
}
}
}
},
transform : function(m) {
return { columns : [
['x', new Date().getTime()],
['Bytes Written', m.devices[i].output.Bytes_Read],
['Bytes Read', m.devices[i].output.Bytes_Written]
] };
}
});
您正在使用devices[i]
,但是您没有定义 i
是什么。你需要给i
一个值,如果你要使用它作为一个数组索引。
相关文章:
- 未捕获TypeError: Cannot read property 'geocode'未定义的'
- SailsJs中的错误.TypeError: Cannot read property '的定义
- 未捕获的TypeError: Cannot read property 'top'的定义
- 未捕获的TypeError: Cannot read property '未定义的数据表
- 未捕获的TypeError: Cannot read property 'timing'的定义
- 未捕获的TypeError: Cannot read property 'checked'零
- 未捕获的TypeError: Cannot read property 'top'在引导中单击导航栏时未
- Extjs5 treepanel [Uncaught TypeError: Cannot read property &
- TypeError: Cannot read property 'submit'添加到购物车'
- 添加自定义jquery.验证方法导致Uncaught TypeError: Cannot read property &
- Vue 2和Vue- resource [Cannot read property 'get'未定义的(
- asp:textbox Uncaught TypeError: Cannot read property 'va
- TypeError: Cannot read property 'search' of undefine
- 读取json时出错未捕获类型错误:Cannot read property 'output'的定义
- 未捕获的TypeError: Cannot read property 'current'在选择任何选项
- 未捕获的TypeError: Cannot read property '3'的定义
- jquery-ui.js:12443未捕获的TypeError: Cannot read property 'a
- jquery Uncaught TypeError: Cannot read property 'left
- 未捕获类型错误:Cannot read property 'print'的定义
- TokenInput + Uncaught TypeError: Cannot read property 't