如何在vis.js上添加网格点击添加范围项目

时间:2017-06-13 13:26:12

标签: vis.js

我是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
            }
          });
        }


  };

0 个答案:

没有答案