我是vis.js的新手,想修改默认添加项目点击时间轴网格,使其创建一个小时长度的范围项目。这可能吗? //时间轴的配置
var options = {
stack: true,
// display in UTC
moment: function(date) {
return vis.moment(date).utc();
},
start: today1,
end: today2,
editable: true,
snap: function (date, scale, step) {
var minit = 60 * 1000;
return Math.round(date / minit) * minit;
},
orientation: 'top',
showCurrentTime: false,
onAdd: function (items, callback) {
prettyPrompt('Add item', 'Enter text content for new item:', items.content, function (value) {
if (value) {
items.content = value;
callback(items); // send back adjusted new item
}
else {
callback(null); // cancel item creation
}
});
},
onUpdate: function (items, callback) {
prettyPrompt('Update item', 'Edit items text:', items.content, function (value) {
if (value) {
items.content = value;
callback(items); // send back adjusted item
}
else {
callback(null); // cancel updating the item
}
});
}
};