我有条形图和日期选择器Bootstrap
我的条形图工作正常,它在选择一天时加载数据。
但在开发人员工具中,我遇到了这些恼人的错误:
未捕获的类型错误:无法读取未定义的Morris 1590的属性“标签” 未捕获的类型错误:无法读取未定义的Morris 424的属性“长度”
我想知道如何解决这个问题。我不想在那里遇到那些错误。
function hourString(hour) {
if (hour === 0) {
return "12:00 am";
}
if (hour < 12) {
return hour + ":00 am";
}
if (hour === 12) {
return "12:00 pm";
}
return (hour - 12) + ":00 pm";
}
var ordersPackChart =
Morris.Bar({
element: 'morris-bar-chart',
data: [],
xkey: 'y',
ykeys: ['a'],
ymax: 1000,
labels: ['Pack per hour'],
hideHover: true,
resize: true,
barColors: ['#ed5565'],
parseTime: false
});
function packResult(historydate, result) {
result = JSON.parse(result);
var data = [];
for (var hour = 6; hour < 24; hour++) {
var numberPack = 0;
for (var i = 0; i < result.Result.length; i++) {
if (result.Result[i].PACK_HOUR == hour) {
numberPack = result.Result[i].NUM_ORDER_PACK;
break;
}
}
data.push({ y: hourString(hour), a: numberPack });
}
ordersPackChart.setData(data);
}
$(document).ready(function () {
$("#fromdate").datepicker({
autoclose: true
}).change(dateChanged)
.on('changeDate', dateChanged);
});
function dateChanged(ev) {
$(this).datepicker('hide');
var day = $('#fromdate').val();
$.ajax({
type: "GET",
url: '@Url.Action("GetQueryResult")',
context: document.body,
data: {
querySetName: 'dashboard-packorder-statistics',
queryName: 'OrderPack',
historydate: day
},
success: function (result) {
packResult(ordersPackChart.HISTORY_DATE, result);
},
error: function (xhr) {
var message = "ErrorStatus: " + xhr.status + " ReadyState: " + xhr.readyState;
}
});
}
// Reload the Morris chart
jQuery(function ($) {
$('#fromdate').on('change', function () {
ordersPackChart.options.fromdate = $(this).is('changeDate');
ordersPackChart.redraw();
});
});
答案 0 :(得分:1)
我解决了我的问题。 每当我的鼠标悬停在图表中而没有数据时就会出现这些错误。我修好了。而且我也是两次调用datepicker的事件。
这些是我的更改
.data
array: .string "123456"
.equ len.array,.-array
.align
.text
.global main
main:
nop
ldr r2,=array // pointer
MOV r0, #0 // initialise loop index to 0
MOV r1, #len.array // number of elements
Loop:
ldrb r3, [r2,r0]
cmp r3, #0x34 // #4
beq _do_something
ADD r0, r0, #1 //increment loop index
CMP r0, r1
BLE Loop
_exit:
mov r7, #1
svc 0
_do_something:
ldr r10,=0xdeadc0de